X-Git-Url: https://us-delaporte.pagekite.me/gitweb/dotfiles.git/blobdiff_plain/22fdba5c42888bef609df368904504883dc5d26c..745e9e99b48808aba45bb6adb65363b28effd62d:/files/pc/tasks.py diff --git a/files/pc/tasks.py b/files/pc/tasks.py index edaf571..52ea8c6 100644 --- a/files/pc/tasks.py +++ b/files/pc/tasks.py @@ -1,5 +1,3 @@ - - # This file is meant to sit in ~ for use from all shells. from invoke import task @@ -8,8 +6,38 @@ import os HOME = os.path.expanduser('~') TODAY = dt.now().strftime('%Y.%m.%d') +PAYROLL = os.environ.get('PAYROLL') +SCHOOL = f"{HOME}/School" + +expect_URLs = [ +'budget', +'cu', +'allowance' +] + +expect_PATHs = [ +'podcasts', +] + + + +URLS = {} +for url in expect_URLs: + key = f'URL_{url.upper()}' + result = os.environ.get(key) + if not result: + raise ValueError(f'Missing expected {key} in environment.') + URLS[url] = result + + +PATHS = {} +for path in expect_PATHs: + key = f'PATH_{path.upper()}' + result = os.environ.get(key) + if not result: + raise ValueError(f'Missing expected {key} in environment.') + PATHS[path] = result -KIDS_ALLOWANCE_URL=os.environ.get('KIDS_ALLOWANCE_URL') def browse(c, url): c.run(f"librefox {url}", asynchronous=True) @@ -21,31 +49,133 @@ def code(c, path): def folder(c, path): c.run(f"nemo {path}") + c.run(f"dolphin {path}") + +@task +def go(c, bookmark): + var = f'URL_{bookmark.upper()}' + url = os.environ.get(var) + browse(c, url) +@task +def cloud_panel(c): + go(c, 'cloud') @task def debug(c): result = c.run('which minetest') print(result.ok) -PAYROLL = f"{HOME}/Nanny.Payroll" @task -def folder_payroll(c): - code(c, f"{HOME}/Nanny.Payroll") +def fix_mouse(c): + c.run('xinput --disable 18') + c.run('xinput --enable 18') + @task -def folder_allowance(c): - browse(c, KIDS_ALLOWANCE_URL) +def fix_invoke_complete(c): + c.run('invoke --print-completion-script bash > ~/.invoke-complete.sh') +@task +def temp(c): + c.run('sensors') + + + +def term(c, path): + c.run(f'konsole --separate --workdir {path}', asynchronous=True) + +def browse(c, url): + c.run(f"librewolf {url}", asynchronous=True) + + +def code(c, path): + c.run(f"codium {path}") + + +def folder(c, path): + c.run(f'dolphin {path}', asynchronous=True) + # c.run(f"nemo {path}") + + +@task +def debug(c): + result = c.run('which minetest') + print(result.ok) -@task(folder_payroll) -def payroll(c): +@task +def allowance(c): + browse(c, URLS['allowance']) + +@task +def payroll_folders(c): # For copying the latest file in folder(c, f"{HOME}/pixel7adocuments") - folder(c, f"{HOME}/Nanny.Payroll/data/payroll_inbox") + folder(c, f"{PAYROLL}/data/payroll_inbox") + folder(c, f"{PAYROLL}") + - # For running the payroll scripts - c.run(f"cd {PAYROLL};{HOME}/envs/jupyter/bin/jupyter lab") +@task +def payroll(c): + + allowance(c) + payroll_folders(c) + + # For editing files + code(c, f"{PAYROLL}") + print("Use Invoke") + +@task() +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, 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) +@task +def assign_school(c): + term(c, f'{SCHOOL}') + +@task +def mod_luanti(c): + print("https://rubenwardy.com/minetest_modding_book/en/quality/luacheck.html") + term(c, f'{HOME}/.var/app/net.minetest.Minetest/.minetest') + + +@task +def budget(c): + browse(c, URLS['budget']) + browse(c, URLS['cu']) + + +@task +def get_drive_info(c): + # List non-squash, non-tmp drives. + c.run('df -x squashfs -x tmpfs') + c.run('ls /dev/disk/by-label') + + +@task +def podcasts(c): + folder(c, PATHS['podcasts']) + +@task +def matrix(c): + c.run('gomuks')