]> us-delaporte.pagekite.me Git - dotfiles.git/blob - files/ts/tasks.py
1a75292e8339111dc065a23e44d77c3c9a9bcd6a
[dotfiles.git] / files / ts / tasks.py
1 # This file is meant to sit in ~ for use from all shells.
2 # ln -s ~/dotfiles/files/ts/tasks.py ~/tasks.py
3
4 from invoke import task
5
6 from datetime import datetime as dt
7 import os
8
9 HOME = os.path.expanduser('~')
10
11 TODAY = dt.now().strftime('%Y.%m.%d')
12 MONTH = dt.now().strftime('%m')
13 YEAR = dt.now().strftime('%Y')
14 JOURNAL = f"{HOME}/Journal/{YEAR}"
15
16 SECDEV_LIMITED=os.environ.get('SECDEV_LIMITED')
17 SECDEV_MESSAGE_TEMPLATES=os.environ.get('SECDEV_MESSAGE_TEMPLATES')
18 EPICS=os.environ.get('URL_EPICS')
19 MESSAGE_TEMPLATES=os.environ.get('URL_MESSAGE_TEMPLATES')
20 OLLAMA=os.environ.get('OLLAMA')
21
22 # Helper functions for a consistent experience
23
24 @task
25 def journal(c):
26 code(c, f'{HOME}/Journal')
27
28
29 def browse(c, url):
30 c.run(f"firefox {url}", asynchronous=True)
31
32
33 def code(c, path):
34 c.run(f"codium {path}", asynchronous=True)
35
36
37 def folder(c, path):
38 c.run(f"nemo {path}")
39
40
41
42 @task
43 def debug(c):
44 result = c.run('which minetest')
45 print(result.ok)
46
47
48 @task()
49 def dash(c):
50 c.run('wtfutil')
51
52 @task
53 def calendar_week(c):
54 browse(c, "https://outlook.office.com/calendar/view/week")
55
56
57 @task
58 def vasl(c):
59 '''Submit time off'''
60 browse(c, "https://my.techservices.illinois.edu/vacation/submitdays.asp")
61 browse(c, "https://outlook.office.com/calendar/view/week")
62 print('Ctrl+G to repeat a search in FF')
63
64
65 @task(vasl)
66 def timesheets(c):
67 '''Reconcile time off between reporting systems'''
68 browse(c, "https://outlook.office.com/calendar/view/month")
69 code(c, f"{HOME}/src/Learn_RobotFramework_IllinoisPTR")
70 browse(c, "http://go.illinois.edu/techservtimeentry")
71
72 @task(journal)
73 def daily(c):
74 '''Open daily reminders file for this month'''
75 code(c, f'{JOURNAL}/{MONTH}-daily.md')
76
77
78
79 @task()
80 def in_progress(c):
81 '''Show in progress items on the Kan-Ban board'''
82 browse(c, 'https://github.com/orgs/techservicesillinois/projects/10/views/11')
83
84
85 @task(daily, in_progress)
86 def status(c):
87 '''Check on status of priorities'''
88 browse(c, EPICS)
89 dash(c)
90 pass
91
92
93
94 @task
95 def backlog(c):
96 '''Prep for backlog grooming'''
97 browse(c, 'https://github.com/orgs/techservicesillinois/projects/10/views/7')
98
99
100 @task(journal)
101 def retro(c):
102 '''Prep for team retrospective meeting'''
103
104 # Create and open retro notes file
105 retro_file = f'{JOURNAL}/{TODAY}.Retro.md'
106 if(not os.path.exists(retro_file)):
107 c.run(f'{HOME}/envs/jinja/bin/jinja2 -D DATE={TODAY} {JOURNAL}/Retro.Template.md > {retro_file}')
108 code(c, retro_file)
109
110 # Close issues this sprint
111 browse(c, 'https://github.com/orgs/techservicesillinois/projects/10/views/5')
112
113 # Shared folder for archiving Retro notes
114 browse(c, SECDEV_LIMITED)
115
116
117 @task(journal)
118 def engagements_ods(c):
119 '''For recording engagements'''
120 c.run(f'soffice {JOURNAL}/Data/engagements.ods', asynchronous=True)
121 # TODO: Launch Jupyter container on this folder as well
122
123 @task
124 def gather_data(c):
125 raise NotImplementedError()
126 # TODO: Add GH command to gather latest data files.
127
128
129 @task(engagements_ods)
130 def wins(c):
131 '''For recording team wins'''
132 code(c, f'{JOURNAL}/{YEAR}-Wins.md')
133
134 @task
135 def co_authors(c):
136 browse(c, 'https://github.com/orgs/techservicesillinois/projects/10?pane=info')
137
138 @task
139 def limited(c):
140 browse(c, SECDEV_LIMITED)
141
142 @task(engagements_ods, calendar_week)
143 def engage(c):
144 # Cybersecrity Development Message Templates
145 browse(c, SECDEV_MESSAGE_TEMPLATES)
146
147
148 @task
149 def juice_shop(c):
150 '''Run a copy of intentionally vulnerable OWASP Juice Shop web app, for demonstrations'''
151 c.run('podman run -d -p 3000:3000 bkimminich/juice-shop', asynchronous=True)
152 print('Visit localhost:3000 for juice shop.')
153
154
155 @task
156 def bookmarks(c):
157 code(c, f'{JOURNAL}/bookmarks.md')
158
159
160 @task
161 def message_templates(c):
162 browse(c, MESSAGE_TEMPLATES)
163
164 @task
165 def ollama(c):
166 print(f'ssh -t {OLLAMA} "ollama run glm-4.7-flash"')
167
168