From 5b4357fffb2cf4e2aead57f05e15987cddf7dc7b Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Mon, 21 Oct 2024 21:29:39 +0200 Subject: Update --- rssfeeds | 3 +-- shenanigans.sh | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/rssfeeds b/rssfeeds index d81968d..503daaa 100755 --- a/rssfeeds +++ b/rssfeeds @@ -18,8 +18,6 @@ https://szymonkaliski.com/feed.xml https://world.hey.com/dhh/feed.atom https://mitchellh.com/feed.xml https://matt-rickard.com/rss -https://solar.lowtechmagazine.com/posts/index.xml -https://utcc.utoronto.ca/~cks/space/blog/?atom https://neil.computer/rss/ https://matduggan.com/rss/ https://michael.stapelberg.ch/feed.xml @@ -29,6 +27,7 @@ https://mirzapandzo.com/rss.xml https://mitjafelicijan.com/feed.xml https://crawl.develz.org/wordpress/feed https://go.dev/blog/feed.atom +https://www.youtube.com/feeds/videos.xml?channel_id=UCUSck1dOH7VKmG4lRW7tZXg https://www.youtube.com/feeds/videos.xml?channel_id=UCkK9UDm_ZNrq_rIXCz3xCGA https://www.youtube.com/feeds/videos.xml?channel_id=UCwgKmJM4ZJQRJ-U5NjvR2dg https://www.youtube.com/feeds/videos.xml?channel_id=UC8DntJ-sBtgC-jA0yEjxqjw diff --git a/shenanigans.sh b/shenanigans.sh index 29dbf0a..ce71021 100755 --- a/shenanigans.sh +++ b/shenanigans.sh @@ -44,6 +44,9 @@ export PATH=$HOME/Applications:$PATH export PATH=$HOME/go/bin:$PATH export PATH=/usr/local/go/bin:$PATH +# Other paths. +export PATH=$HOME/.local/bin/odin-linux-amd64-dev-2024-1:$PATH + # History and search. Stolen from J. HISTCONTROL=ignoreboth shopt -s histappend @@ -95,3 +98,76 @@ backup() { cd $CWD } +export TICKETS=~/Vault/tickets +tt() { # https://github.com/mitjafelicijan/ticket + if [ "$(uname -s)" != "Linux" ]; then + printf "Currently only Linux is supported.\n" + return 1 + fi + + if [ -z "$TICKETS" ]; then + TICKETS="$HOME/tickets" + fi + + mkdir -p $TICKETS + + # Display open tickets if no argument provided. + if [ -z "$1" ]; then + echo "`tt -o`" + return 0 + fi + + case $1 in + -n|-new) + ticket_id=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 10 | head -n 1) + ticket_file=$TICKETS/$ticket_id + printf "id: %s\n" $ticket_id > $ticket_file + printf "responsible: %s\n" `whoami`@`hostname` >> $ticket_file + printf "created: %s\n" "`date`" >> $ticket_file + printf "status: open\n" >> $ticket_file + printf "title: ?\n" >> $ticket_file + printf "====\n" >> $ticket_file + printf "Describe your problem here\n" >> $ticket_file + $EDITOR $ticket_file + ;; + -o|-open) + printf "%-12s %-21s %s\n" "Ticket ID" "Created at" "Title" + printf "%0.s-" {1..100} + printf "\n" + grep --color=never -l 'status: open' $TICKETS/* | while read file; do + id=$(head -n 1 "$file" | tail -n 1 | awk '{ print $2 }') + title=$(head -n 5 "$file" | tail -n 1 | awk '{$1=""; print $0}') + cdate=$(head -n 3 "$file" | tail -n 1 | awk '{$1=""; print $0}') + cdate_fmt=$(date -d "$cdate" "+%Y-%m-%d %H:%M:%S") + printf "%-12s %-20s %.66s\n" "$id" "$cdate_fmt" "$title" + done + ;; + -c|-closed) + printf "%-12s %-21s %s\n" "Ticket ID" "Created at" "Title" + printf "%0.s-" {1..100} + printf "\n" + grep --color=never -l 'status: closed' $TICKETS/* | while read file; do + id=$(head -n 1 "$file" | tail -n 1 | awk '{ print $2 }') + title=$(head -n 5 "$file" | tail -n 1 | awk '{$1=""; print $0}') + cdate=$(head -n 3 "$file" | tail -n 1 | awk '{$1=""; print $0}') + cdate_fmt=$(date -d "$cdate" "+%Y-%m-%d %H:%M:%S") + printf "%-12s %-20s %.66s\n" "$id" "$cdate_fmt" "$title" + done + ;; + -h|-help) + printf "Usage: ticket [option]\n" + printf " -n, -new creates a new ticket\n" + printf " -o, -open lists open tickets\n" + printf " -c, -closed lists closed tickets\n" + printf " -h, -help shows this help\n" + ;; + *) + if [ -e "$TICKETS/$1" ] && [ -f "$TICKETS/$1" ]; then + $EDITOR "$TICKETS/$1" + else + printf "Ticket not found: $TICKETS/$1\n" + fi + ;; + esac +} + -- cgit v1.2.3