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