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