]> apps.delaporte.us Git - dotfiles.git/blob - files/tab/tasks.py
Add budget shortcut
[dotfiles.git] / files / tab / tasks.py
1 # This file is meant to sit in ~ for use from all shells.
2 from invoke import task
3
4 from datetime import datetime as dt
5 import os
6
7 HOME = os.path.expanduser('~')
8 TODAY = dt.now().strftime('%Y.%m.%d')
9
10 KIDS_ALLOWANCE_URL=os.environ.get('KIDS_CASH_URL')
11 PAYROLL = os.environ.get('PAYROLL')
12 BUDGET_URL = os.environ.get('BUDGET_URL')
13 CU_URL = os.environ.get('CU_URL')
14
15 def term(c, path):
16 c.run(f'konsole --separate --workdir {path}', asynchronous=True)
17
18 def browse(c, url):
19 c.run(f"librewolf {url}", asynchronous=True)
20
21
22 def code(c, path):
23 c.run(f"codium {path}")
24
25
26 def folder(c, path):
27 c.run(f'dolphin {path}', asynchronous=True)
28 # c.run(f"nemo {path}")
29
30
31 @task
32 def debug(c):
33 result = c.run('which minetest')
34 print(result.ok)
35
36
37 @task
38 def allowance(c):
39 browse(c, KIDS_ALLOWANCE_URL)
40
41
42
43 @task
44 def payroll(c):
45
46 allowance(c)
47
48 # For copying the latest file in
49 folder(c, f"{HOME}/pixel7adocuments")
50 folder(c, f"{PAYROLL}/data/payroll_inbox")
51
52 # For editing files
53 code(c, f"{PAYROLL}")
54
55 payroll_jupyter(c)
56
57 @task
58 def payroll_jupyter(c):
59
60 # For running the payroll scripts
61 c.run(f"cd {PAYROLL};{HOME}/envs/jupyter/bin/jupyter-lab")
62
63
64 @task()
65 def screenshare(c):
66
67 browse(c, 'https://app.screego.net/#/')
68 c.run('dino')
69
70 @task
71 def show_free_space(c):
72 c.run('df -h | grep G') # We only care about disks measured in G
73
74 @task()
75 def free_disk_space(c, ruthless=False):
76 show_free_space(c)
77 c.run('podman container cleanup --all --rm')
78 # Dolphin Trash ...should regenerate
79 c.run(f'sudo rm -rf {HOME}/.local/share/Trash')
80 # c.run(f'rm {HOME}/Downloads/*.iso')
81 c.run('sudo apt-get autoclean') # Remove useless apt cache
82 if ruthless:
83 c.run(f'rm -rf {HOME}/Downloads/*')
84 c.run('sudo apt-get clean') # Remove all apt cache
85 show_free_space(c)
86
87
88
89
90 SCHOOL = f"{HOME}/School"
91
92 @task
93 def assign_school(c):
94 term(c, f'{SCHOOL}')
95 # c.run(f"cd {SCHOOL};{HOME}/envs/jupyter/bin/jupyter lab", asynchronous=True)
96
97
98 @task
99 def mod_luanti(c):
100 print("https://rubenwardy.com/minetest_modding_book/en/quality/luacheck.html")
101 term(c, f'{HOME}/.var/app/net.minetest.Minetest/.minetest')
102
103
104 @task
105 def budget(c):
106 browse(c, BUDGET_URL)
107 browse(c, CU_URL)
108