]> apps.delaporte.us Git - dotfiles.git/blob - files/pc/tasks.py
6e145b8c0f478d8eaeff121519afca600b032c18
[dotfiles.git] / files / pc / 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 KIDS_ALLOWANCE_URL=os.environ.get('KIDS_ALLOWANCE_URL')
10 PAYROLL = os.environ.get('PAYROLL')
11 BUDGET_URL = os.environ.get('BUDGET_URL')
12 CU_URL = os.environ.get('CU_URL')
13 SCHOOL = f"{HOME}/School"
14 PAYROLL = f"{HOME}/Nanny.Payroll"
15
16 def browse(c, url):
17 c.run(f"librefox {url}", asynchronous=True)
18
19
20 def code(c, path):
21 c.run(f"codium {path}")
22
23
24 def folder(c, path):
25 c.run(f"nemo {path}")
26
27
28 @task
29 def debug(c):
30 result = c.run('which minetest')
31 print(result.ok)
32
33
34 @task
35 def fix_mouse(c):
36 c.run('xinput --disable 18')
37 c.run('xinput --enable 18')
38
39
40 @task
41 def fix_invoke_complete(c):
42 c.run('invoke --print-completion-script bash > ~/.invoke-complete.sh')
43
44 @task
45 def temp(c):
46 c.run('sensors')
47
48
49
50 def term(c, path):
51 c.run(f'konsole --separate --workdir {path}', asynchronous=True)
52
53 def browse(c, url):
54 c.run(f"librewolf {url}", asynchronous=True)
55
56
57 def code(c, path):
58 c.run(f"codium {path}")
59
60
61 def folder(c, path):
62 c.run(f'dolphin {path}', asynchronous=True)
63 # c.run(f"nemo {path}")
64
65
66 @task
67 def debug(c):
68 result = c.run('which minetest')
69 print(result.ok)
70
71
72 @task
73 def allowance(c):
74 browse(c, KIDS_ALLOWANCE_URL)
75
76
77 @task
78 def payroll(c):
79
80 allowance(c)
81
82 # For copying the latest file in
83 folder(c, f"{HOME}/pixel7adocuments")
84 folder(c, f"{PAYROLL}/data/payroll_inbox")
85
86 # For editing files
87 folder_payroll(c)
88 payroll_jupyter(c)
89
90 @task
91 def payroll_jupyter(c):
92
93 # For running the payroll scripts
94 c.run(f"cd {PAYROLL};{HOME}/envs/jupyter/bin/jupyter-lab")
95
96 @task
97 def folder_payroll(c):
98 code(c, f"{PAYROLL}")
99
100
101 @task()
102 def screenshare(c):
103 browse(c, 'https://app.screego.net/#/')
104 c.run('dino')
105
106 @task
107 def show_free_space(c):
108 c.run('df -h | grep G') # We only care about disks measured in G
109
110 @task()
111 def free_disk_space(c, ruthless=False):
112 show_free_space(c)
113 c.run('podman container cleanup --all --rm')
114 # Dolphin Trash ...should regenerate
115 c.run(f'sudo rm -rf {HOME}/.local/share/Trash')
116 # c.run(f'rm {HOME}/Downloads/*.iso')
117 c.run('sudo apt-get autoclean') # Remove useless apt cache
118 if ruthless:
119 c.run(f'rm -rf {HOME}/Downloads/*')
120 c.run('sudo apt-get clean') # Remove all apt cache
121 show_free_space(c)
122
123 @task
124 def assign_school(c):
125 term(c, f'{SCHOOL}')
126
127 @task
128 def mod_luanti(c):
129 print("https://rubenwardy.com/minetest_modding_book/en/quality/luacheck.html")
130 term(c, f'{HOME}/.var/app/net.minetest.Minetest/.minetest')
131
132
133 @task
134 def budget(c):
135 browse(c, BUDGET_URL)
136 browse(c, CU_URL)
137
138