Skip to content

Commit

Permalink
Merge branch 'master' of github.com:palladius/sakura
Browse files Browse the repository at this point in the history
2406:da00:ff00::22c3:9b0a ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==
2406:da00:ff00::22c3:9b0a ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==
  • Loading branch information
palladius committed Mar 18, 2024
2 parents c1ec03e + c6c24ca commit d7ab82e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/gcloud_auth_check
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ end

def main()
verbose = ENV.fetch('VERBOSE', "false").downcase == 'true'
final_message = oauth_tokeinfo_curl(verbose: )
final_message = oauth_tokeinfo_curl(verbose: verbose)
puts("|OAuthInfo| #{final_message}")
# silently removing this silly file
`rm .t`
Expand Down
42 changes: 42 additions & 0 deletions bin/pip-date
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python3

# copied from https://stackoverflow.com/questions/24736316/see-when-packages-were-installed-updated-using-pip

# NON VA
# import pip, os, time
# for package in pip.get_installed_distributions():
# print("%s: %s" % (package, time.ctime(os.path.getctime(package.location))))


# import pkg_resources, os, time
# for package in pkg_resources.working_set:
# print("%s: %s" % (package, time.ctime(os.path.getctime(package.location))))

# Better dates
from importlib.metadata import distributions
import os, time
from datetime import date, timedelta
today = date.today()

HIDE_OLD_ENOUGH = True # TODO implement
OBSOLESCENCE_DAYS = int(os.getenv("OBSOLESCENCE_DAYS", 80))
pkgs_to_uninstall = []

print(f"Showing PIP installed packages within {OBSOLESCENCE_DAYS} days (Change with ENV[OBSOLESCENCE_DAYS])")
for dist in distributions():
dist_time = time.ctime(os.path.getctime(dist._path))
creation_time = os.path.getctime(dist._path)
creation_time_int = int(creation_time)
# Convert creation time to date object
creation_date = date.fromtimestamp(creation_time_int)
time_delta = today - creation_date # creation_date
difference_in_days = time_delta.days

#print(f"Delta: {difference_in_days}")
if difference_in_days < OBSOLESCENCE_DAYS:
print("🐍 %s %s: %s (%dd ago)" % (dist.metadata["Name"], dist.version, dist_time, difference_in_days))
pkgs_to_uninstall.append( dist.metadata["Name"] )

if len(pkgs_to_uninstall) > 0:
print("Command to uninstall recent packages (use at your own DANGER!):")
print(f"$ echo pip uninstall {' '.join(pkgs_to_uninstall)}")

0 comments on commit d7ab82e

Please sign in to comment.