Commit 450c807

xxwhirlpool  ·  2026-03-12 17:05:21 -0400 EDT
parent 2871ca1
misc
8 files changed,  +20, -12
+1, -0
......@@ -11,6 +11,7 @@ fi
1111 if [[ ! "$(command -v batcat)" ]]; then
1212 cat_cmd="cat"
1313 else
14+ export BAT_PAGER=""
1415 cat_cmd="batcat"
1516 fi
1617
+8, -1
......@@ -1,3 +1,10 @@
11 #!/usr/bin/env bash
22
3-micro "$(command -v "$1")"
3+cmd="$1"
4+
5+if [[ ! $(command -v "$cmd") ]]; then
6+ echo "command does not exist"
7+ exit 1
8+fi
9+
10+micro "$(command -v "$cmd")"
+2, -2
......@@ -6,7 +6,7 @@
66 # - `lowerd -i`
77
88 default() {
9- tr '[:upper:]' '[:lower:]' | tee >(xclip -selection clipboard)
9+ tr '[:upper:]' '[:lower:]' | perl -pe "chomp if eof" | tee >(xclip -selection clipboard)
1010 }
1111
1212 takearg() {
......@@ -14,7 +14,7 @@ takearg() {
1414 }
1515
1616 stdinpaste() {
17- gum write --header="paste text here" | tr '[:upper:]' '[:lower:]' | batcat --paging=never | tee >(xclip -selection clipboard)
17+ gum write --header="paste text here" | tr '[:upper:]' '[:lower:]' | perl -pe "chomp if eof" | batcat --paging=never | tee >(xclip -selection clipboard)
1818 }
1919
2020 case "$1" in
+1, -1
......@@ -11,7 +11,7 @@
1111 # functions
1212 fromstdin() {
1313 # declare some vars
14- MDFILE="/tmp/$(openssl rand -hex 5).md"
14+ MDFILE=$(mktemp --suffix .md)
1515 HTMLFILE="${MDFILE%.*}.html"
1616 HTMLFILE_FINAL="${HTMLFILE%.*}_final.html"
1717 # prompt user to paste markdown formatted text, then write it to a temp file
+1, -1
......@@ -8,4 +8,4 @@ cd "$WORKDIR" || exit 1
88
99 for f in *.jpg; do mv "$f" "$TMPDIR"; done
1010
11-cd "$TMPDIR" && magick -size 3000x4000 ./*glob*.jpg -resize 40% "../${f%.*}-resized.jpg" && rm -rf ./*glob*.jpg
11+cd "$TMPDIR" && magick -size 3000x4000 *.jpg -resize 40% "../${f%.*}-resized.jpg" && rm -rf *.jpg
+3, -3
......@@ -1,7 +1,7 @@
11 #!/usr/bin/env bash
22
33 unwraptxt() {
4- TXTFILE="/tmp/$(openssl rand -hex 5).txt"
4+ TXTFILE=$(mktemp --suffix .txt)
55 TXTFILE_FIN="${TXTFILE%.*}_final.txt"
66 gum write --header="paste wrapped text below" > "$TXTFILE"
77 perl -00 -lpe 's/\n/ /g' < "$TXTFILE" > "$TXTFILE_FIN"
......@@ -11,7 +11,7 @@ unwraptxt() {
1111 }
1212
1313 wraptxt() {
14- WRTXTFILE="/tmp/$(openssl rand -hex 5).txt"
14+ WRTXTFILE=$(mktemp --suffix .txt)
1515 WRTXTFILE_FIN="${WRTXTFILE%.*}_final.txt"
1616 gum write --header="paste text below" > "$WRTXTFILE"
1717 FOLDNUM=$(gum input --placeholder "number of characters to wrap to")
......@@ -22,7 +22,7 @@ wraptxt() {
2222 }
2323
2424 wdcount() {
25- WCTXTFL="/tmp/$(openssl rand -hex 5).txt"
25+ WCTXTFL=$(mktemp --suffix .txt)
2626 gum write --header="paste text below" > "$WCTXTFL"
2727 WCNUM=$(wc -w "$WCTXTFL" | awk '{print $1}')
2828 echo -e "$(gum style --foreground=#f4b8e4 --border none 'total word count'): $WCNUM"
+2, -2
......@@ -6,7 +6,7 @@
66 # - `upperd -i`
77
88 default() {
9- tr '[:lower:]' '[:upper:]' | tee >(xclip -selection clipboard)
9+ tr '[:lower:]' '[:upper:]' | perl -pe "chomp if eof" | tee >(xclip -selection clipboard)
1010 }
1111
1212 takearg() {
......@@ -14,7 +14,7 @@ takearg() {
1414 }
1515
1616 stdinpaste() {
17- gum write --header="paste text here" | tr '[:lower:]' '[:upper:]' | batcat --paging=never | tee >(xclip -selection clipboard)
17+ gum write --header="paste text here" | tr '[:lower:]' '[:upper:]' | perl -pe "chomp if eof" | batcat --paging=never | tee >(xclip -selection clipboard)
1818 }
1919
2020 case "$1" in
+2, -2
......@@ -8,5 +8,5 @@ if [ $# -eq 0 ]; then
88 fi
99
1010 # format:
11-# best audio + best video, excluding AI upscales
12-yt-dlp -f "ba/best[format_id!*=-sr]+bv*[format_id!*=-sr]" "$URL"
11+# best audio + best video
12+yt-dlp -f "ba+bv" "$URL"