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