]>
apps.delaporte.us Git - dotfiles.git/blob - files/pc/tasks.py
1 # This file is meant to sit in ~ for use from all shells.
2 from invoke
import task
4 from datetime
import datetime
as dt
7 HOME
= os
.path
.expanduser('~')
8 TODAY
= dt
.now().strftime('%Y.%m.%d')
9 PAYROLL
= os
.environ
.get('PAYROLL')
10 SCHOOL
= f
"{HOME}/School"
20 for url
in expect_URLs
:
21 key
= f
'URL_{url.upper()}'
22 result
= os
.environ
.get(key
)
24 raise ValueError(f
'Missing expected {key} in environment.')
28 c
.run(f
"librefox {url}", asynchronous
=True)
32 c
.run(f
"codium {path}")
40 var
= f
'URL_{bookmark.upper()}'
41 url
= os
.environ
.get(var
)
50 result
= c
.run('which minetest')
56 c
.run('xinput --disable 18')
57 c
.run('xinput --enable 18')
61 def fix_invoke_complete(c
):
62 c
.run('invoke --print-completion-script bash > ~/.invoke-complete.sh')
71 c
.run(f
'konsole --separate --workdir {path}', asynchronous
=True)
74 c
.run(f
"librewolf {url}", asynchronous
=True)
78 c
.run(f
"codium {path}")
82 c
.run(f
'dolphin {path}', asynchronous
=True)
83 # c.run(f"nemo {path}")
88 result
= c
.run('which minetest')
94 browse(c
, URLS
['allowance'])
97 def payroll_folders(c
):
98 # For copying the latest file in
99 folder(c
, f
"{HOME}/pixel7adocuments")
100 folder(c
, f
"{PAYROLL}/data/payroll_inbox")
101 folder(c
, f
"{PAYROLL}")
111 code(c
, f
"{PAYROLL}")
115 def payroll_jupyter(c
):
117 # For running the payroll scripts
118 c
.run(f
"cd {PAYROLL};{HOME}/envs/jupyter/bin/jupyter-lab")
123 browse(c
, 'https://app.screego.net/#/')
127 def show_free_space(c
):
128 c
.run('df -h | grep G') # We only care about disks measured in G
131 def free_disk_space(c
, ruthless
=False):
133 c
.run('podman container cleanup --all --rm')
134 # Dolphin Trash ...should regenerate
135 c
.run(f
'sudo rm -rf {HOME}/.local/share/Trash')
136 # c.run(f'rm {HOME}/Downloads/*.iso')
137 c
.run('sudo apt-get autoclean') # Remove useless apt cache
139 c
.run(f
'rm -rf {HOME}/Downloads/*')
140 c
.run('sudo apt-get clean') # Remove all apt cache
144 def assign_school(c
):
149 print("https://rubenwardy.com/minetest_modding_book/en/quality/luacheck.html")
150 term(c
, f
'{HOME}/.var/app/net.minetest.Minetest/.minetest')
155 browse(c
, BUDGET_URL
)
160 def get_drive_info(c
):
161 # List non-squash, non-tmp drives.
162 c
.run('df -x squashfs -x tmpfs')
163 c
.run('ls /dev/disk/by-label')