]> us-delaporte.pagekite.me Git - dotfiles.git/blobdiff - files/tab/tasks.py
Add commands to free disk space on Linux Mint
[dotfiles.git] / files / tab / tasks.py
index cedc6755be9f6798bfce4724a15dcc9b9ffb240b..9a187d2b8e4d6a24e5369cc7ba782f3ba2122f26 100644 (file)
@@ -1,5 +1,3 @@
-
-
 # This file is meant to sit in ~ for use from all shells.
 from invoke import task
 
@@ -12,6 +10,8 @@ TODAY = dt.now().strftime('%Y.%m.%d')
 KIDS_ALLOWANCE_URL=os.environ.get('KIDS_CASH_URL')
 PAYROLL = os.environ.get('PAYROLL')
 
+def term(c, path):
+    c.run(f'konsole --workdir {path}')
 
 def browse(c, url):
     c.run(f"librewolf {url}", asynchronous=True)
@@ -60,15 +60,31 @@ def screenshare(c):
     browse(c, 'https://app.screego.net/#/')
     c.run('dino')
 
+@task
+def show_free_space(c):
+    c.run('df -h | grep G')  # We only care about disks measured in G
+
 @task()
-def free_disk_space(c):
+def free_disk_space(c, ruthless=False):
+    show_free_space(c)
     c.run('podman container cleanup --all --rm')
+    # Dolphin Trash ...should regenerate
+    c.run(f'sudo rm -rf {HOME}/.local/share/Trash')
+    # c.run(f'rm {HOME}/Downloads/*.iso')
+    c.run('sudo apt-get autoclean') # Remove useless apt cache
+    if ruthless:
+        c.run(f'rm -rf {HOME}/Downloads/*')
+        c.run('sudo apt-get clean') # Remove all apt cache
+    show_free_space(c)
+
+
 
 
 SCHOOL = f"{HOME}/School"
 
 @task
 def assign_school(c):
-    c.run(f"cd {SCHOOL};{HOME}/envs/jupyter/bin/jupyter lab")
+    term(c, f'{SCHOOL}')
+    # c.run(f"cd {SCHOOL};{HOME}/envs/jupyter/bin/jupyter lab", asynchronous=True)