Update

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2024-10-21 21:29:39 +0200
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2024-10-21 21:29:39 +0200
Commit 5b4357fffb2cf4e2aead57f05e15987cddf7dc7b (patch)
-rwxr-xr-x rssfeeds 3
-rwxr-xr-x shenanigans.sh 76
2 files changed, 77 insertions, 2 deletions
diff --git a/rssfeeds b/rssfeeds
...
18
https://world.hey.com/dhh/feed.atom
18
https://world.hey.com/dhh/feed.atom
19
https://mitchellh.com/feed.xml
19
https://mitchellh.com/feed.xml
20
https://matt-rickard.com/rss
20
https://matt-rickard.com/rss
21
https://solar.lowtechmagazine.com/posts/index.xml
  
22
https://utcc.utoronto.ca/~cks/space/blog/?atom
  
23
https://neil.computer/rss/
21
https://neil.computer/rss/
24
https://matduggan.com/rss/
22
https://matduggan.com/rss/
25
https://michael.stapelberg.ch/feed.xml
23
https://michael.stapelberg.ch/feed.xml
...
29
https://mitjafelicijan.com/feed.xml
27
https://mitjafelicijan.com/feed.xml
30
https://crawl.develz.org/wordpress/feed
28
https://crawl.develz.org/wordpress/feed
31
https://go.dev/blog/feed.atom
29
https://go.dev/blog/feed.atom
  
30
https://www.youtube.com/feeds/videos.xml?channel_id=UCUSck1dOH7VKmG4lRW7tZXg
32
https://www.youtube.com/feeds/videos.xml?channel_id=UCkK9UDm_ZNrq_rIXCz3xCGA
31
https://www.youtube.com/feeds/videos.xml?channel_id=UCkK9UDm_ZNrq_rIXCz3xCGA
33
https://www.youtube.com/feeds/videos.xml?channel_id=UCwgKmJM4ZJQRJ-U5NjvR2dg
32
https://www.youtube.com/feeds/videos.xml?channel_id=UCwgKmJM4ZJQRJ-U5NjvR2dg
34
https://www.youtube.com/feeds/videos.xml?channel_id=UC8DntJ-sBtgC-jA0yEjxqjw
33
https://www.youtube.com/feeds/videos.xml?channel_id=UC8DntJ-sBtgC-jA0yEjxqjw
...
diff --git a/shenanigans.sh b/shenanigans.sh
...
44
export PATH=$HOME/go/bin:$PATH
44
export PATH=$HOME/go/bin:$PATH
45
export PATH=/usr/local/go/bin:$PATH
45
export PATH=/usr/local/go/bin:$PATH
46
  
46
  
  
47
# Other paths.
  
48
export PATH=$HOME/.local/bin/odin-linux-amd64-dev-2024-1:$PATH
  
49
  
47
# History and search. Stolen from J.
50
# History and search. Stolen from J.
48
HISTCONTROL=ignoreboth
51
HISTCONTROL=ignoreboth
49
shopt -s histappend
52
shopt -s histappend
...
95
	cd $CWD
98
	cd $CWD
96
}
99
}
97
  
100
  
  
101
export TICKETS=~/Vault/tickets
  
102
tt() { # https://github.com/mitjafelicijan/ticket
  
103
	if [ "$(uname -s)" != "Linux" ]; then
  
104
		printf "Currently only Linux is supported.\n"
  
105
		return 1
  
106
	fi
  
107
  
  
108
	if [ -z "$TICKETS" ]; then
  
109
		TICKETS="$HOME/tickets"
  
110
	fi
  
111
  
  
112
	mkdir -p $TICKETS
  
113
  
  
114
	# Display open tickets if no argument provided.
  
115
	if [ -z "$1" ]; then
  
116
		echo "`tt -o`"
  
117
		return 0
  
118
	fi
  
119
  
  
120
	case $1 in
  
121
		-n|-new)
  
122
			ticket_id=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 10 | head -n 1)
  
123
			ticket_file=$TICKETS/$ticket_id
  
124
			printf "id: %s\n" $ticket_id > $ticket_file
  
125
			printf "responsible: %s\n" `whoami`@`hostname` >> $ticket_file
  
126
			printf "created: %s\n" "`date`" >> $ticket_file
  
127
			printf "status: open\n" >> $ticket_file
  
128
			printf "title: ?\n" >> $ticket_file
  
129
			printf "====\n" >> $ticket_file
  
130
			printf "Describe your problem here\n" >> $ticket_file
  
131
			$EDITOR $ticket_file
  
132
			;;
  
133
		-o|-open)
  
134
			printf "%-12s %-21s %s\n" "Ticket ID" "Created at" "Title"
  
135
			printf "%0.s-" {1..100}
  
136
			printf "\n"
  
137
			grep --color=never -l 'status: open' $TICKETS/* | while read file; do
  
138
				id=$(head -n 1 "$file" | tail -n 1 | awk '{ print $2 }')
  
139
				title=$(head -n 5 "$file" | tail -n 1 | awk '{$1=""; print $0}')
  
140
				cdate=$(head -n 3 "$file" | tail -n 1 | awk '{$1=""; print $0}')
  
141
				cdate_fmt=$(date -d "$cdate" "+%Y-%m-%d %H:%M:%S")
  
142
				printf "%-12s %-20s %.66s\n" "$id" "$cdate_fmt" "$title"
  
143
			done
  
144
			;;
  
145
		-c|-closed)
  
146
			printf "%-12s %-21s %s\n" "Ticket ID" "Created at" "Title"
  
147
			printf "%0.s-" {1..100}
  
148
			printf "\n"
  
149
			grep --color=never -l 'status: closed' $TICKETS/* | while read file; do
  
150
				id=$(head -n 1 "$file" | tail -n 1 | awk '{ print $2 }')
  
151
				title=$(head -n 5 "$file" | tail -n 1 | awk '{$1=""; print $0}')
  
152
				cdate=$(head -n 3 "$file" | tail -n 1 | awk '{$1=""; print $0}')
  
153
				cdate_fmt=$(date -d "$cdate" "+%Y-%m-%d %H:%M:%S")
  
154
				printf "%-12s %-20s %.66s\n" "$id" "$cdate_fmt" "$title"
  
155
			done
  
156
			;;
  
157
		-h|-help)
  
158
			printf "Usage: ticket [option]\n"
  
159
			printf "  -n, -new          creates a new ticket\n"
  
160
			printf "  -o, -open         lists open tickets\n"
  
161
			printf "  -c, -closed       lists closed tickets\n"
  
162
			printf "  -h, -help         shows this help\n"
  
163
			;;
  
164
		*)
  
165
			if [ -e "$TICKETS/$1" ] && [ -f "$TICKETS/$1" ]; then
  
166
				$EDITOR "$TICKETS/$1"
  
167
			else
  
168
				printf "Ticket not found: $TICKETS/$1\n"
  
169
			fi
  
170
			;;
  
171
	esac
  
172
}
  
173