X-Git-Url: https://us-delaporte.pagekite.me/gitweb/dotfiles.git/blobdiff_plain/c8ad4de7c70926e41526f772eeb9dc0cbe79f7b6..90653b13bfc7a4f9be2b16d07bee3e398390aae3:/files/ts/tasks.py?ds=inline diff --git a/files/ts/tasks.py b/files/ts/tasks.py index 5e50693..9fdeffe 100644 --- a/files/ts/tasks.py +++ b/files/ts/tasks.py @@ -1,4 +1,6 @@ # This file is meant to sit in ~ for use from all shells. +# ln -s ~/dotfiles/files/ts/tasks.py ~/tasks.py + from invoke import task from datetime import datetime as dt @@ -7,13 +9,35 @@ import os HOME = os.path.expanduser('~') TODAY = dt.now().strftime('%Y.%m.%d') +MONTH = dt.now().strftime('%m') +YEAR = dt.now().strftime('%Y') +JOURNAL = f"{HOME}/Journal/{YEAR}" + +SECDEV_LIMITED=os.environ.get('SECDEV_LIMITED') +SECDEV_MESSAGE_TEMPLATES=os.environ.get('SECDEV_MESSAGE_TEMPLATES') +EPICS=os.environ.get('URL_EPICS') +MESSAGE_TEMPLATES=os.environ.get('URL_MESSAGE_TEMPLATES') +OLLAMA=os.environ.get('OLLAMA') + +# Helper functions for a consistent experience + +@task +def journal(c): + editor(c, f'{HOME}/Journal') + def browse(c, url): - c.run(f"firefox {url}") + c.run(f"firefox {url}", asynchronous=True) + +def editor(c, path): + # c.run(f"codium {path}", asynchronous=True) + c.run(f"vi {path}", pty=True) + + +def folder(c, path): + c.run(f"nemo {path}") -def code(c, path): - c.run(f"codium {path}") @task @@ -22,24 +46,53 @@ def debug(c): print(result.ok) +@task() +def dash(c): + c.run('wtfutil') + +@task +def calendar_week(c): + browse(c, "https://outlook.office.com/calendar/view/week") + + @task def vasl(c): '''Submit time off''' - c.run(f"firefox https://my.techservices.illinois.edu/vacation/submitdays.asp") + browse(c, "https://my.techservices.illinois.edu/vacation/submitdays.asp") browse(c, "https://outlook.office.com/calendar/view/week") + print('Ctrl+G to repeat a search in FF') @task(vasl) def timesheets(c): '''Reconcile time off between reporting systems''' browse(c, "https://outlook.office.com/calendar/view/month") - code(c, f"{HOME}/src/Learn_RobotFramework_IllinoisPTR") + editor(c, f"{HOME}/src/Learn_RobotFramework_IllinoisPTR") + browse(c, "http://go.illinois.edu/techservtimeentry") + +@task() +def daily(c): + '''Open daily reminders file for this month''' + editor(c, f'{JOURNAL}/{MONTH}-daily.md') + +@task() +def in_progress(c): + '''Show in progress items on the Kan-Ban board''' + browse(c, 'https://github.com/orgs/techservicesillinois/projects/10/views/11') + @task +def epics(c): + browse(c, EPICS) + + +@task(daily, in_progress, epics) def status(c): '''Check on status of priorities''' - browse('https://github.com/orgs/techservicesillinois/projects/10') + dash(c) + pass + @task @@ -47,15 +100,73 @@ def backlog(c): '''Prep for backlog grooming''' browse(c, 'https://github.com/orgs/techservicesillinois/projects/10/views/7') -JOURNAL = f"{HOME}/Journal" -@task +@task(journal) def retro(c): + '''Prep for team retrospective meeting''' + # Close issues this sprint + browse(c, 'https://github.com/orgs/techservicesillinois/projects/10/views/5') + + # Shared folder for archiving Retro notes + browse(c, SECDEV_LIMITED) + # Create and open retro notes file retro_file = f'{JOURNAL}/{TODAY}.Retro.md' if(not os.path.exists(retro_file)): c.run(f'{HOME}/envs/jinja/bin/jinja2 -D DATE={TODAY} {JOURNAL}/Retro.Template.md > {retro_file}') + editor(c, retro_file) + + - code(c, retro_file) +@task +def engagements_ods(c): + '''For recording engagements''' + +@task +def gather_data(c): + raise NotImplementedError() + # TODO: Add GH command to gather latest data files. + + +@task +def wins(c): + '''For recording team wins''' + editor(c, f'{JOURNAL}/{YEAR}-Wins.md') + c.run(f'soffice {JOURNAL}/Data/engagements.ods', asynchronous=True) + + +@task +def co_authors(c): + browse(c, 'https://github.com/orgs/techservicesillinois/projects/10?pane=info') + +@task +def limited(c): + browse(c, SECDEV_LIMITED) + +@task(engagements_ods, calendar_week) +def engage(c): + # Cybersecrity Development Message Templates + browse(c, SECDEV_MESSAGE_TEMPLATES) + + +@task +def juice_shop(c): + '''Run a copy of intentionally vulnerable OWASP Juice Shop web app, for demonstrations''' + c.run('podman run -d -p 3000:3000 bkimminich/juice-shop', asynchronous=True) + print('Visit localhost:3000 for juice shop.') + + +@task +def bookmarks(c): + editor(c, f'{JOURNAL}/bookmarks.md') + + +@task +def message_templates(c): + browse(c, MESSAGE_TEMPLATES) + +@task +def ollama(c): + print(f'ssh -t {OLLAMA} "ollama run glm-4.7-flash"')