dots


commit
4936460
parent
96382a2
author
xxwhirlpool
date
2026-03-18 11:08:06 -0400 EDT
script cleanup; fix up `nag` a lil
11 files changed,  +34, -22
M config/.local/bin/ask
+2, -2
 1@@ -2,9 +2,9 @@
 2 #
 3 # basic confirmation dialog
 4 
 5-if [ $# -eq 0 ]; then
 6+if [[ $# -eq 0 ]]; then
 7 	echo "Usage: ask [COMMAND]"
 8 	exit 1
 9 fi
10 
11-gum confirm && $@ || echo "nope"
12+gum confirm && "$@" || echo "nope"
M config/.local/bin/askdd
+2, -2
 1@@ -1,7 +1,7 @@
 2 #!/usr/bin/env bash
 3 
 4 warning() {
 5-	if [[ "$*" =~ $(df . | awk {'print $1'} | tail -n1) ]]; then
 6+	if [[ "$*" =~ $(df . | awk "{print $1}" | tail -n1) ]]; then
 7 		if ! gum confirm "WARNING: you are executing this command on your current drive! be careful!" --default="false" --timeout="15s"; then
 8 			echo "nope"
 9 			exit 1
10@@ -9,4 +9,4 @@ warning() {
11 	fi
12 }
13 
14-warning $@
15+warning "$@"
M config/.local/bin/dict
+1, -1
1@@ -6,7 +6,7 @@
2 
3 word=$(echo " " | dmenu -i -c -l 10 -p "dictionary!")
4 
5-if [ -n "$word" ]; then
6+if [[ -n "$word" ]]; then
7 	response=$(curl -s --connect-timeout 5 --max-time 10 "https://api.dictionaryapi.dev/api/v2/entries/en_US/$word")
8 	notif=$(echo "$response" | jq -r '[.[].meanings[] | {pos: .partOfSpeech, def: .definitions[].definition}] | .[:3].[] | "\n\(.pos). \(.def)"')
9 
M config/.local/bin/mksh
+1, -1
1@@ -1,6 +1,6 @@
2 #!/usr/bin/env bash
3 
4-if [ $# -eq 0 ]; then
5+if [[ $# -eq 0 ]]; then
6 	echo "Usage: mksh [-b] [FILENAME]"
7 	echo "       --bin puts it in PATH"
8 	echo "       otherwise default to pwd"
M config/.local/bin/nag
+18, -6
 1@@ -1,16 +1,28 @@
 2 #!/usr/bin/env bash
 3 
 4-if [ $# -eq 0 ]; then
 5+if [[ $# -eq 0 ]]; then
 6 	echo "Usage: nag [MINUTES]"
 7 	exit 1
 8 fi
 9 
10-DURATION=$(( "$1" * 60 ))
11-DURATION_M=$(( "$DURATION"/60%60 ))
12+NUM="$1"
13+
14+if [[ ! $NUM =~ ^[0-9]+$ ]]; then
15+	echo "duration cannot be a decimal"
16+	exit 1
17+fi
18 
19+DURATION=$(( "$NUM" * 60 ))
20+DURATION_M=$(( "$DURATION"/60%60 ))
21 MSG="it's been $DURATION_M minutes"
22 
23-notify-send "you'll get a reminder every $DURATION_M minutes"
24+notif() {
25+	notify-send "$MSG" && sleep 1 && spd-say -t female3 "$MSG"
26+}
27+
28+logic() {
29+	notify-send "you'll get a reminder every $DURATION_M minutes"
30+	sleep "$DURATION" && notif
31+}
32 
33-sleep "$DURATION"
34-notify-send "$MSG" && sleep 1 && spd-say -t female3 "$MSG"
35+logic
M config/.local/bin/passmenu
+1, -1
1@@ -20,5 +20,5 @@ password=$(printf '%s\n' "${password_files[@]}" | dmenu -i -c -l 10 "$@")
2 if [[ $typeit -eq 0 ]]; then
3 	pass show -c "$password" 2>/dev/null
4 else
5-	pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool
6+	pass show "$password" | { IFS= read -r pass; printf %s "$pass"; }
7 fi
M config/.local/bin/recordscreen
+1, -1
1@@ -22,7 +22,7 @@ end() {
2 
3 cmd=$(printf "start\nend\n" | dmenu -i -c -l 2 -p "screen rec")
4 
5-if [ -z "$cmd" ]; then
6+if [[ -z "$cmd" ]]; then
7 	exit 0
8 fi
9 
M config/.local/bin/share
+4, -4
 1@@ -2,13 +2,13 @@
 2 #
 3 # quickly share files
 4 
 5-if [ $# -eq 0 ]; then
 6+if [[ $# -eq 0 ]]; then
 7 	echo "Usage: share [FILENAME]"
 8 	exit 1
 9 fi
10 
11-FN_TEMP=$(uuidgen)_$(basename "${1// /_}")
12+upload_filename=$(uuidgen)_$(basename "${1// /_}")
13 
14-rsync -avzqp --chmod=664 "$1" athena:/var/www/stash/pics/dump/"$FN_TEMP" || exit 1
15+rsync -avzqp --chmod=664 "$1" athena:/var/www/stash/pics/dump/"$upload_filename" || exit 1
16 
17-echo "https://stash.4-walls.net/pics/dump/$FN_TEMP" | lolcat
18+echo "https://stash.4-walls.net/pics/dump/$upload_filename" | lolcat
M config/.local/bin/snsclip
+1, -1
1@@ -9,7 +9,7 @@
2 URL="$1"
3 FILE_OUT_NAME="$2"
4 
5-if [ $# -eq 0 ]; then
6+if [[ $# -eq 0 || $# -ne 2 ]]; then
7 	echo "Usage: snsclip [URL] [FILENAME]"
8 	exit 1
9 fi
M config/.local/bin/today
+2, -2
 1@@ -1,12 +1,12 @@
 2 #!/usr/bin/env bash
 3 
 4 # current date in ISO format
 5-if [ $# -eq 0 ]; then
 6+if [[ $# -eq 0 ]]; then
 7 	echo -e "$(date '+%Y-%m-%d')"
 8 fi
 9 
10 # if you also want time then supply `time` arg:
11 # today time
12-if [ "$1" == "time" ]; then
13+if [[ "$1" == "time" ]]; then
14 	echo -e "$(date '+%Y-%m-%d__%I_%M%p')"
15 fi
M config/.local/bin/ytbest
+1, -1
1@@ -2,7 +2,7 @@
2 
3 URL="$1"
4 
5-if [ $# -eq 0 ]; then
6+if [[ $# -eq 0 ]]; then
7 	echo "Usage: ytbest [URL]"
8 	exit 1
9 fi