]>
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"
25 for url
in expect_URLs
:
26 key
= f
'URL_{url.upper()}'
27 result
= os
.environ
.get(key
)
29 print(f
'Missing expected {key} in environment.')
30 # raise ValueError(f'Missing expected {key} in environment.')
35 for path
in expect_PATHs
:
36 key
= f
'PATH_{path.upper()}'
37 result
= os
.environ
.get(key
)
39 print(f
'Missing expected {key} in environment.')
44 c
.run(f
"librefox {url}", asynchronous
=True)
48 c
.run(f
"codium {path}")
53 c
.run(f
"dolphin {path}")
57 var
= f
'URL_{bookmark.upper()}'
58 url
= os
.environ
.get(var
)
67 result
= c
.run('which minetest')
73 c
.run('xinput --disable 18')
74 c
.run('xinput --enable 18')
78 def fix_invoke_complete(c
):
79 c
.run('invoke --print-completion-script bash > ~/.invoke-complete.sh')
88 c
.run(f
'konsole --separate --workdir {path}', asynchronous
=True)
91 c
.run(f
"librewolf {url}", asynchronous
=True)
95 c
.run(f
"codium {path}")
99 c
.run(f
'dolphin {path}', asynchronous
=True)
100 # c.run(f"nemo {path}")
105 result
= c
.run('which minetest')
111 browse(c
, URLS
['allowance'])
114 def payroll_folders(c
):
115 # For copying the latest file in
116 folder(c
, f
"{HOME}/pixel7adocuments")
117 folder(c
, f
"{PAYROLL}/data/payroll_inbox")
118 folder(c
, f
"{PAYROLL}")
128 code(c
, f
"{PAYROLL}")
133 browse(c
, 'https://app.screego.net/#/')
137 def show_free_space(c
):
138 c
.run('df -h | grep G') # We only care about disks measured in G
141 def free_disk_space(c
, ruthless
=False):
143 c
.run('podman container cleanup --all --rm')
144 # Dolphin Trash ...should regenerate
145 c
.run(f
'sudo rm -rf {HOME}/.local/share/Trash')
146 # c.run(f'rm {HOME}/Downloads/*.iso')
147 c
.run('sudo apt-get autoclean') # Remove useless apt cache
149 c
.run(f
'rm -rf {HOME}/Downloads/*')
150 c
.run('sudo apt-get clean') # Remove all apt cache
154 def assign_school(c
):
159 print("https://rubenwardy.com/minetest_modding_book/en/quality/luacheck.html")
160 term(c
, f
'{HOME}/.var/app/net.minetest.Minetest/.minetest')
165 browse(c
, URLS
['budget'])
166 browse(c
, URLS
['cu'])
170 def get_drive_info(c
):
171 # List non-squash, non-tmp drives.
172 c
.run('df -x squashfs -x tmpfs')
173 c
.run('ls /dev/disk/by-label')
178 folder(c
, PATHS
['podcasts'])