From 3d3d79a57fb6d0a5728e0070475f05d1699f0818 Mon Sep 17 00:00:00 2001 From: Timmy Keller Date: Wed, 16 Mar 2022 23:37:09 -0500 Subject: move a lot of scripts around and make a bunch of minor changes. once again i am too lazy to document the changes properly since im never going to read these commit messages anyways --- bar/batterynotification | 2 - bar/calendarnotification | 2 - bar/netnotification | 5 --- bar/wmip | 2 +- init/g610bl | 2 - keyboard/bl | 30 ------------- keyboard/mounter | 2 +- launch/launch | 110 ++++++++++++++++++++++++---------------------- misc/hwtexedit | 49 --------------------- misc/lipsum | 90 ------------------------------------- misc/lsdu | 2 +- misc/mksh | 6 +-- misc/seasonalwallpaper | 13 +++--- misc/setup | 76 -------------------------------- misc/verify | 16 ++++--- old/bsdtpscroll | 4 ++ old/ffconcat | 12 +++++ old/hwtexedit | 49 +++++++++++++++++++++ old/lipsum.~1~ | 90 +++++++++++++++++++++++++++++++++++++ old/rectape | 13 ++++++ old/rectapevaapi | 12 +++++ old/settitle | 4 ++ old/setup | 76 ++++++++++++++++++++++++++++++++ old/speedtest | 8 ++++ old/speedtest-cli | 8 ++++ old/testtimmywm | 5 +++ old/transtape | 11 +++++ old/viewintensitypro | 4 ++ old/webcamdesktopffplay | 2 + old/win10 | 4 ++ old/ytdl-dlplst | 5 +++ pkgmgt/xbps/xs | 22 ---------- video/ffconcat | 12 ----- video/rectape | 13 ------ video/rectapevaapi | 12 ----- video/transtape | 11 ----- video/viewintensitypro | 4 -- video/webcamdesktopffplay | 2 - video/win10 | 4 -- video/ytdl-dlplst | 5 --- x11/bsdtpscroll | 4 -- x11/capsmap | 8 ---- x11/settitle | 4 -- x11/testtimmywm | 5 --- x11/xkeyconf | 12 +++++ 45 files changed, 398 insertions(+), 434 deletions(-) delete mode 100755 bar/batterynotification delete mode 100755 bar/calendarnotification delete mode 100755 bar/netnotification delete mode 100755 init/g610bl delete mode 100755 keyboard/bl delete mode 100755 misc/hwtexedit delete mode 100755 misc/lipsum delete mode 100755 misc/setup create mode 100755 old/bsdtpscroll create mode 100755 old/ffconcat create mode 100755 old/hwtexedit create mode 100755 old/lipsum.~1~ create mode 100755 old/rectape create mode 100755 old/rectapevaapi create mode 100755 old/settitle create mode 100755 old/setup create mode 100755 old/speedtest create mode 100755 old/speedtest-cli create mode 100755 old/testtimmywm create mode 100755 old/transtape create mode 100755 old/viewintensitypro create mode 100755 old/webcamdesktopffplay create mode 100755 old/win10 create mode 100755 old/ytdl-dlplst delete mode 100755 pkgmgt/xbps/xs delete mode 100755 video/ffconcat delete mode 100755 video/rectape delete mode 100755 video/rectapevaapi delete mode 100755 video/transtape delete mode 100755 video/viewintensitypro delete mode 100755 video/webcamdesktopffplay delete mode 100755 video/win10 delete mode 100755 video/ytdl-dlplst delete mode 100755 x11/bsdtpscroll delete mode 100755 x11/capsmap delete mode 100755 x11/settitle delete mode 100755 x11/testtimmywm create mode 100755 x11/xkeyconf diff --git a/bar/batterynotification b/bar/batterynotification deleted file mode 100755 index 5cdb2fb..0000000 --- a/bar/batterynotification +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -notify-send "Battery info:" "`blr -eElL`" diff --git a/bar/calendarnotification b/bar/calendarnotification deleted file mode 100755 index 39df717..0000000 --- a/bar/calendarnotification +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -notify-send -u low -t 10000 "`date +'%m/%d/%Y %T'`" "`cal | tr '[:upper:]' '[:lower:]'`\n`date +'day %0j, week %0U, q%q'`" diff --git a/bar/netnotification b/bar/netnotification deleted file mode 100755 index ee68238..0000000 --- a/bar/netnotification +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -ip="`ip addr | sed -n '/\slo/d; s/\/.*//; s/\s*inet /IP Address:\t/p;'`" -ssid="`iw wlp3s0 link | sed -n 's/\s*SSID:\s*/SSID:\t\t/p'`" - -notify-send -u low "Network info:" "$ip\n$ssid" diff --git a/bar/wmip b/bar/wmip index 63e5676..3105038 100755 --- a/bar/wmip +++ b/bar/wmip @@ -1,2 +1,2 @@ #!/bin/sh -ip addr | awk '!/ lo/ && /inet / { sub(/\/.*/, "", $2); print $2 }' +ip a | awk '!/ lo/ && /inet / { sub(/\/.*/, "", $2); print $2 }' diff --git a/init/g610bl b/init/g610bl deleted file mode 100755 index 9cf38b4..0000000 --- a/init/g610bl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -g610-led -fx color keys 20 && g610-led -k logo 00 diff --git a/keyboard/bl b/keyboard/bl deleted file mode 100755 index 2bbd951..0000000 --- a/keyboard/bl +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -xbacklight -$1 $2 -time 50 -steps 5 2>/dev/null && exit - -red=16 -green=18 -blue=1A -getbl() { bl=$(doas ddcutil getvcp $red | sed 's/.*current value =\s*\([0-9]*\).*/\1/'); } # Get brightness of red channel so we only have to grab one -case "$1" in - dec) - getbl - [ $bl = 0 ] && exit - bl=$(( bl - $2 )) - [ $bl -lt 0 ] && bl=0 - ;; - inc) - getbl - [ $bl = 100 ] && exit - bl=$(( bl + $2 )) - [ $bl -gt 100 ] && bl=100 - ;; - set) - bl=$2 - [ $bl -lt 0 ] || [ $bl -gt 100 ] && echo "Invalid value" && exit - ;; - *) - echo "Invalid option" && exit - ;; -esac -for color in $red $green $blue; do doas ddcutil setvcp $color $bl; done -#dwmsbup 20 diff --git a/keyboard/mounter b/keyboard/mounter index 49d0b76..90c6caf 100755 --- a/keyboard/mounter +++ b/keyboard/mounter @@ -57,7 +57,7 @@ umnt() { || $notify "Error Unmounting Device \"$part\" from \"$mp\"" "$umountout" # Remove mp directory if it is in mps - [ "$(dirname "$mp")" = $mps ] && rm -rf "$mp" + [ "$(dirname "$mp")" = $mps ] && [ ! "$(ls -A "$mp")" ] && rm -rf "$mp" } case $1 in diff --git a/launch/launch b/launch/launch index 8e4cbd2..b4c1c7a 100755 --- a/launch/launch +++ b/launch/launch @@ -1,68 +1,74 @@ #!/bin/sh me() { basename "$0"; } + printhelp() { - echo "Usage:\n" \ - " $(me): [-gh] [COMMAND] [COMMAND ARGS]...\n\n" \ - "Args:\n" \ - " -g: Force generate cache\n" \ - " -h: show this help message\n\n" \ - "Config Syntax:\n" \ - " +host [HOSTNAME]\n" \ - " Add a new host. Hosts can be referenced using their number starting with 1.\n" \ - " [COMMAND]\n" \ - " launch [COMMAND] will start the process specified for the specific hostname. Aliases are separated by |.\n" \ - " [TAB][SHELL]\n" \ - " Run this shell command when the above [COMMAND] is specified. In order of hostnames. Can be a number to reference to a hostname, a '-' to disregard this command for the specific host, or a '^' to reference the previous command." +cat << HELPDOC +Usage: + $(me): [-gh] [COMMAND] [COMMAND ARGS]... + +Args: + -g: Force generate cache + -h: show this help message + +Config Syntax: + +host [HOSTNAME] + Add a new host. Hosts can be referenced using their number starting with 1. + [COMMAND] + launch [COMMAND] will start the process specified for the specific hostname. Aliases are separated by |. + [TAB][SHELL] + Run this shell command when the above [COMMAND] is specified. In order of hostnames. Can be a number to reference to a hostname, a '-' to disregard this command for the specific host, or a '^' to reference the previous command. +HELPDOC } + gencache() { - awk ' - BEGIN { - print "run=\"$1\"; shift" - print "case \"$run\" in" - } - { - sub(/#.*/, "") # Remove comments - if (!/^\s*$/) { - if (/^\+host/) { - sub(/\s*\+host\s*/, "") - h++ - hosts[h] = $0 +awk ' + BEGIN { + print "run=\"$1\"; shift" + print "case \"$run\" in" + } + { + sub(/#.*/, "") # Remove comments + if (!/^\s*$/) { + if (/^\+host/) { + sub(/\s*\+host\s*/, "") + h++ + hosts[h] = $0 + } + else { + if (!/^\t/) { + hostnum = 1 + o++ + opts[o] = $0 } else { - if (!/^\t/) { - hostnum = 1 - o++ - opts[o] = $0 - } - else { - sub(/^\t/, "") - if ($0 == "^") - $0 = cache - else if ($0 ~ /^[0-9]*$/) - $0 = cmds[hosts[$0]":"opts[o]] - cmds[hosts[hostnum]":"opts[o]] = cache = $0 - hostnum++ - } + sub(/^\t/, "") + if ($0 == "^") + $0 = cache + else if ($0 ~ /^[0-9]*$/) + $0 = cmds[hosts[$0]":"opts[o]] + cmds[hosts[hostnum]":"opts[o]] = cache = $0 + hostnum++ } } } - END { - for (host in hosts) { - if (hosts[host] != "'`hostname`'") - continue - for (cmd in cmds) { - if (cmd ~ hosts[host] && cmds[cmd] && cmds[cmd] != "-") { - i = cmd - sub(/.*:/, "", cmd) - print "\t"cmd") "cmds[i]" \"$@\" & ;;" - } + } + END { + for (host in hosts) { + if (hosts[host] != "'`hostname`'") + continue + for (cmd in cmds) { + if (cmd ~ hosts[host] && cmds[cmd] && cmds[cmd] != "-") { + i = cmd + sub(/.*:/, "", cmd) + print "\t"cmd") "cmds[i]" \"$@\" & ;;" } - print "\t*) command -v \"$run\" >/dev/null && exec \"$run\" \"$@\" || echo \"\\`$run${@:+ $@}\\` Does not exist or exited with an error\" ;;" - print "esac" } + print "\t*) command -v \"$run\" >/dev/null && exec \"$run\" \"$@\" || echo \"\\`$run${@:+ $@}\\` Does not exist or exited with an error\" ;;" + print "esac" } - ' $conf > $cache - chmod +x $cache + } +' $conf > $cache +chmod +x $cache } # Config file setup diff --git a/misc/hwtexedit b/misc/hwtexedit deleted file mode 100755 index 262d10b..0000000 --- a/misc/hwtexedit +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -dir=~/docs/school - -files="$(find $dir -name \*.tex -printf "%T@ %p\n" | sort -nr | cut -d' ' -f 2-)" - -echo "$files" | awk ' -function printcol(c1, c2, c3) { printf "%-12s %-32s %s\n", c1, c2, c3 } -BEGIN { - printcol(" class:", "containing dir:", "file:") - fn = 1 -} -{ - tf = c = cf = $0 - sub(/.*\//, "", tf) - sub("'$dir'/", "", c) - sub(/\/.*/, "", c) - sub("'$dir'/"c"/", "", cf) - sub("/"tf, "", cf) - printcol(fn": "c, cf, tf) - fn++ -} -' -read -p "Choose file number: " filenum -file="$(echo "$files" | head -$filenum | tail -1)" -dir="$(echo "$file" | sed 's/\(\/.*\)\/.*/\1/')" - -cd "$dir" - -st -e $EDITOR "$file" & -echo "$file" | entr pdflatex -output-directory "$dir" "$file" || echo "entr or LaTeX is not installed!" & -zathura "$(echo "$file" | sed 's/.tex$/.pdf/')" & - -#listfiles() { -# pids=$(xdotool search --class "Vim") -# for pid in $pids; do -# names="$(xdotool getwindowname $pid | grep '\.tex')\n$names" -# #$openfiles="$(echo "$name" | cut -d' ' -f1)\n$openfiles" -# #$openfilepaths="$(echo "$name" | awk -F'[()]' '{ print $2 }')\n$openfiles" -# done -# #file="$(echo $openfiles | grep "^$1")" -# [ -z "$file" ] \ -# && interactiveopt "$(echo $openfiles | sort -bu | tail +2)" "Which file to autocompile? " 1 \ -# && file="$opt" -#} -# -#[ -e "$1" ] && file="$1" || listfiles -# -#echo "$file" | entr pdflatex "$file" || echo "entr or LaTeX is not installed!" - diff --git a/misc/lipsum b/misc/lipsum deleted file mode 100755 index efa71b5..0000000 --- a/misc/lipsum +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/awk -f - -function printusage() { - print "Usage: lipsum [# of] [w/words|s/sentences|p/paragraphs] [1/t/true|0/f/false output 'lorem ipsum' in first entry] [min words] [max words]\n" - exit 1 -} - -function capitalize(word) { - sub(/./, toupper(substr(word, 0, 1)), word) - print word -} - -function isint(arg) { - return arg ~ /^[0-9]+$/ -} - -function randrange(min, max) { - return int((rand() * (max - min)) + min) -} - -function genword() { - wc++ # There's gotta be a more efficient way of doing this - return (wc > 5 || !litextout) ? word[randrange(0, dictlen)] : litext[wc - 1] -} - -function genwords(words) { - if (words > 0) { - capitalize(genword()) - for (i = 1; i < words; i++) - print " " genword() - print "\n" - } -} - -function gensentences(sentences, delim, min, max) { - for (; sentences > 0; sentences--) { - capitalize(genword()) - words = randrange(min, max) # Isn't possible to initialize or increment multiple variables in awk for loops - for (i = 1; i < words; i++) - print (rand() < 0.10 ? ", " : " ") genword() - print delim - } -} - -function genparagraphs(paragraphs, min, max) { - for (; paragraphs > 0; paragraphs--) { - print "\t" - gensentences(randrange(6, 10), ". ", min, max) - print "\n" - } -} - -BEGIN { - dictionary = "/home/timmy/.local/share/lorem-ipsum-dictionary" # List of lorem ipsum words separated by newlines - litext[0] = "lorem"; litext[1] = "ipsum"; litext[2] = "dolor"; litext[3] = "sit"; litext[4] = "amet" - - ORS = "" - srand() - - for (dictlen = 0; getline < dictionary; dictlen++) - word[dictlen] = $0 - - # Parse Arguments - !isint(ARGV[1]) && ARGV[1] && printusage() - numof = ARGC > 1 ? ARGV[1] : 5 - mode = ARGC > 2 ? ARGV[2] : "p" - litextout = 1 - if (ARGV[3]) - switch (ARGV[3]) { - case /^1$|^t$|^true$/: litextout = 1; break - case /^0$|^f$|^false$/: litextout = 0; break - default: printusage() - } - min = isint(ARGV[4]) ? ARGV[4] : 5 - max = isint(ARGV[5]) ? ARGV[5] : 12 - - switch (mode) { - case /^w$|^words$/: - genwords(numof) - break - case /^s$|^sentences$/: - gensentences(numof, ".\n", min, max) - break - case /^p$|^paragraphs$/: - genparagraphs(numof, min, max) - break - default: - printusage() - } -} diff --git a/misc/lsdu b/misc/lsdu index ef3eb97..cc57b7a 100755 --- a/misc/lsdu +++ b/misc/lsdu @@ -1,5 +1,5 @@ #!/bin/sh -du -ah -d1 "$@" 2>/dev/null | sed 's/\.\///' | sort -h +du -ahd1 "$@" 2>/dev/null | sed 's/\.\///' | sort -h #for file in $(ls -a $1); do # ([ "$file" = "." ] || [ "$file" = ".." ]) && continue # files="${files:+$files\n}$(du -h $1/"$file" 2>/dev/null | tail -1)" diff --git a/misc/mksh b/misc/mksh index 4b94652..eb8bb1f 100755 --- a/misc/mksh +++ b/misc/mksh @@ -3,7 +3,7 @@ newname() { defname="script"; name=$defname`ls | grep "^$defname[0-9]*" | wc -l | tr -d '[:blank:]'`; } # Remove blank space in certain non-GNU implementations of wc [ -z "$1" ] && newname || name="$1" [ -e "$name" ] && echo "File $name exists!" && exit 1 -[ -z "$2" ] && shebang="#!/bin/sh" || shebang="$2" -echo "$shebang" > "$name" && chmod +x "$name" && $EDITOR "$name" -# Delete file if it is just exited w/o being changed +[ -z "$2" ] && shebang="#!/bin/sh" || shebang="#!$2" +echo "$shebang" > "$name" && chmod +x "$name" && ${EDITOR:-vi} "$name" +# Delete file if it is empty [ "`cat "$name"`" = "$shebang" ] && rm "$name" && echo "Removed empty script \"$name\"" || echo "Saved script \"$name\"" diff --git a/misc/seasonalwallpaper b/misc/seasonalwallpaper index 1b5bf4a..525bfb0 100755 --- a/misc/seasonalwallpaper +++ b/misc/seasonalwallpaper @@ -1,13 +1,12 @@ #!/bin/sh case $1 in - spring|summer|fall|winter) dir=~/.local/share/wallpaper/$1/ ; xwallpaper --zoom "$dir`ls $dir | sort --random-sort | head -1`" ;; + spring|summer|fall|winter) dir=~/.local/share/wallpaper/$1/ ; xwallpaper --zoom "$dir`ls $dir | shuf -n1`" ;; *) - case "`date +%b`" in - Dec|Jan|Feb) season=winter ;; - Mar|Apr|May) season=spring ;; - Jun|Jul|Aug) season=summer ;; - Sep|Oct|Nov) season=fall ;; + case `date +%b` in + Dec|Jan|Feb) $0 winter ;; + Mar|Apr|May) $0 spring ;; + Jun|Jul|Aug) $0 summer ;; + Sep|Oct|Nov) $0 fall ;; esac - $0 $season ;; esac diff --git a/misc/setup b/misc/setup deleted file mode 100755 index eaeec39..0000000 --- a/misc/setup +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh - -#interactiveopt() { -# # Usage: interactiveopt "options" "prompt" -# echo "$1" | nl -s': ' 1>&2 -# # Parse user input -# read -p "$2" choices 1>&2 \ -# && choices="$(echo $choices | cut -d' ' -f1-)" -# for choice in $choices; do -# case "$choice" in -# [0-9]*) opt="$opt $(echo "$1" | head -"$(echo $choice | tr -cd '[:digit:]')" | tail -1)";; -# *) echo "Invalid option \"$opt\"" 1>&2 ;; -# esac -# done -# echo "$opt" -#} - -# Open as root in pcmanfm -pcmanfmconf() { - pcmanfmroot=~/.local/share/file-manager/actions - mkdir -p $pcmanfmroot - echo " [Desktop Entry] -Type=Action -Tooltip=Open Folder As Root -Name=Open Folder As Root -Profiles=profile-zero; -Icon=gtk-dialog-authentication - -[X-Action-Profile profile-zero] -MimeTypes=inode/directory; -Exec=/home/timmy/.local/bin/x11/xsudo /usr/bin/pcmanfm %u -Name=Default profile" > $pcmanfmroot/root.desktop -} - -minticons() { - gitdir="/tmp/mint-y-icons" - iconsdir="$gitdir/usr/share/icons" - git clone https://github.com/linuxmint/mint-y-icons.git "$gitdir" - #iconsets="$(interactiveopt "$(ls "$iconsdir")" "Choose icon sets (if using dark theme, COPY THE NON-DARK THEME TOO): ")" - #iconsets="$iconset Mint-Y" - #for iconset in $iconsets; do - # mv "$iconsdir/$iconset" $iconsdestdir - #done - mv $iconsdir/* $iconsdestdir - gtk-update-icon-cache -} - -mintthemes() { - gitdir="/tmp/mint-themes" - themesdir="$gitdir/usr/share/themes" - #iconsdir="$gitdir/usr/share/icons" - git clone https://github.com/linuxmint/mint-themes.git "$gitdir" - curdir="$(pwd)" - cd $gitdir - make - #themes="$(interactiveopt "$(ls "$themesdir")" "Choose themes: ")" - ##iconset="$iconset Mint-Y" - #for theme in $themes; do - # mv "$themesdir/$theme" $themesdestdir - #done - #iconsets="$(interactiveopt "$(ls "$iconsdir")" "Choose icon set (if using dark theme, COPY THE NON-DARK THEME TOO): ")" - #iconset="$iconset Mint-Y" - #for iconset in $iconsets; do - # mv "$iconsdir/$iconset" $iconsdestdir - #done - #gtk-update-icon-cache - mv $themesdir/* $themesdestdir -} - -iconsdestdir=/usr/share/icons -themesdestdir=/usr/share/themes -mkdir -p $iconsdestdir $themesdestdir - -pcmanfmconf -minticons -mintthemes diff --git a/misc/verify b/misc/verify index 0d17085..5f0430c 100755 --- a/misc/verify +++ b/misc/verify @@ -3,19 +3,21 @@ NORM="\033[0m" CYN="\033[0;36m" GRN="\033[0;32m" RED="\033[0;31m" + printhelp() { -echo "\ +cat << HELPDOC Usage: $(basename "$0") [options] [file/directory]... OPTIONS: -m, --md5 Create/verify md5 checksum - -s[alg], --sha[alg] Create/verify sha checksum - -x[alg], --xxh[alg] Create/verify xxh checksum - -c [alg], --crypt [alg] Create/verify [alg] checksum (uses [alg]sum) + -s[mode], --sha[mode] Create/verify sha[mode] checksum + -x[mode], --xxh[mode] Create/verify xxh[mode] checksum (default) + -c [alg], --crypt [alg] Create/verify [alg] checksum (uses [alg]sum program; e.g. '-c sha256' uses sha256sum) -v, --verify Verify files with existing checksums - -h, --help Print help \ -"; + -h, --help Print help +HELPDOC } + crypt=xxh while true; do case "$1" in @@ -30,7 +32,7 @@ while true; do esac shift done -hashalg=${crypt}sum # Works for current algs +hashalg=${crypt}sum command -v $hashalg >/dev/null || (echo "Hashing algorithm '$hashalg' does not exist!" && exit 2) while [ -n "$1" ]; do diff --git a/old/bsdtpscroll b/old/bsdtpscroll new file mode 100755 index 0000000..0f2cd20 --- /dev/null +++ b/old/bsdtpscroll @@ -0,0 +1,4 @@ +#!/bin/sh +xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation" 1 +xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Button" 2 +xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Axes" 6 7 4 5 diff --git a/old/ffconcat b/old/ffconcat new file mode 100755 index 0000000..06eb066 --- /dev/null +++ b/old/ffconcat @@ -0,0 +1,12 @@ +#!/bin/sh +ffconcat="$(ls | sed "s/^/file '/; s/$/'/")" +echo "$ffconcat" > ffconcat + +ffmpeg \ + -f concat \ + -safe 0 \ + -i ffconcat \ + -c copy \ + out.mkv + +rm ffconcat diff --git a/old/hwtexedit b/old/hwtexedit new file mode 100755 index 0000000..262d10b --- /dev/null +++ b/old/hwtexedit @@ -0,0 +1,49 @@ +#!/bin/sh +dir=~/docs/school + +files="$(find $dir -name \*.tex -printf "%T@ %p\n" | sort -nr | cut -d' ' -f 2-)" + +echo "$files" | awk ' +function printcol(c1, c2, c3) { printf "%-12s %-32s %s\n", c1, c2, c3 } +BEGIN { + printcol(" class:", "containing dir:", "file:") + fn = 1 +} +{ + tf = c = cf = $0 + sub(/.*\//, "", tf) + sub("'$dir'/", "", c) + sub(/\/.*/, "", c) + sub("'$dir'/"c"/", "", cf) + sub("/"tf, "", cf) + printcol(fn": "c, cf, tf) + fn++ +} +' +read -p "Choose file number: " filenum +file="$(echo "$files" | head -$filenum | tail -1)" +dir="$(echo "$file" | sed 's/\(\/.*\)\/.*/\1/')" + +cd "$dir" + +st -e $EDITOR "$file" & +echo "$file" | entr pdflatex -output-directory "$dir" "$file" || echo "entr or LaTeX is not installed!" & +zathura "$(echo "$file" | sed 's/.tex$/.pdf/')" & + +#listfiles() { +# pids=$(xdotool search --class "Vim") +# for pid in $pids; do +# names="$(xdotool getwindowname $pid | grep '\.tex')\n$names" +# #$openfiles="$(echo "$name" | cut -d' ' -f1)\n$openfiles" +# #$openfilepaths="$(echo "$name" | awk -F'[()]' '{ print $2 }')\n$openfiles" +# done +# #file="$(echo $openfiles | grep "^$1")" +# [ -z "$file" ] \ +# && interactiveopt "$(echo $openfiles | sort -bu | tail +2)" "Which file to autocompile? " 1 \ +# && file="$opt" +#} +# +#[ -e "$1" ] && file="$1" || listfiles +# +#echo "$file" | entr pdflatex "$file" || echo "entr or LaTeX is not installed!" + diff --git a/old/lipsum.~1~ b/old/lipsum.~1~ new file mode 100755 index 0000000..efa71b5 --- /dev/null +++ b/old/lipsum.~1~ @@ -0,0 +1,90 @@ +#!/usr/bin/awk -f + +function printusage() { + print "Usage: lipsum [# of] [w/words|s/sentences|p/paragraphs] [1/t/true|0/f/false output 'lorem ipsum' in first entry] [min words] [max words]\n" + exit 1 +} + +function capitalize(word) { + sub(/./, toupper(substr(word, 0, 1)), word) + print word +} + +function isint(arg) { + return arg ~ /^[0-9]+$/ +} + +function randrange(min, max) { + return int((rand() * (max - min)) + min) +} + +function genword() { + wc++ # There's gotta be a more efficient way of doing this + return (wc > 5 || !litextout) ? word[randrange(0, dictlen)] : litext[wc - 1] +} + +function genwords(words) { + if (words > 0) { + capitalize(genword()) + for (i = 1; i < words; i++) + print " " genword() + print "\n" + } +} + +function gensentences(sentences, delim, min, max) { + for (; sentences > 0; sentences--) { + capitalize(genword()) + words = randrange(min, max) # Isn't possible to initialize or increment multiple variables in awk for loops + for (i = 1; i < words; i++) + print (rand() < 0.10 ? ", " : " ") genword() + print delim + } +} + +function genparagraphs(paragraphs, min, max) { + for (; paragraphs > 0; paragraphs--) { + print "\t" + gensentences(randrange(6, 10), ". ", min, max) + print "\n" + } +} + +BEGIN { + dictionary = "/home/timmy/.local/share/lorem-ipsum-dictionary" # List of lorem ipsum words separated by newlines + litext[0] = "lorem"; litext[1] = "ipsum"; litext[2] = "dolor"; litext[3] = "sit"; litext[4] = "amet" + + ORS = "" + srand() + + for (dictlen = 0; getline < dictionary; dictlen++) + word[dictlen] = $0 + + # Parse Arguments + !isint(ARGV[1]) && ARGV[1] && printusage() + numof = ARGC > 1 ? ARGV[1] : 5 + mode = ARGC > 2 ? ARGV[2] : "p" + litextout = 1 + if (ARGV[3]) + switch (ARGV[3]) { + case /^1$|^t$|^true$/: litextout = 1; break + case /^0$|^f$|^false$/: litextout = 0; break + default: printusage() + } + min = isint(ARGV[4]) ? ARGV[4] : 5 + max = isint(ARGV[5]) ? ARGV[5] : 12 + + switch (mode) { + case /^w$|^words$/: + genwords(numof) + break + case /^s$|^sentences$/: + gensentences(numof, ".\n", min, max) + break + case /^p$|^paragraphs$/: + genparagraphs(numof, min, max) + break + default: + printusage() + } +} diff --git a/old/rectape b/old/rectape new file mode 100755 index 0000000..1e54370 --- /dev/null +++ b/old/rectape @@ -0,0 +1,13 @@ +#!/bin/sh +if [ -z "$1" ]; then + $1=untitled_$(ls | wc -l) +fi + +ffmpeg \ +-f decklink -format_code ntsc -i "Intensity Pro" \ +-c:v libx264 \ +-qmin 6 -qmax 26 -qdiff 4 \ +-vf yadif \ +-c:a aac -b:a 384k \ +-metadata "title"="$1" \ +"$1.mkv" diff --git a/old/rectapevaapi b/old/rectapevaapi new file mode 100755 index 0000000..16bd190 --- /dev/null +++ b/old/rectapevaapi @@ -0,0 +1,12 @@ +#!/bin/sh +if [ -z "$1" ]; then + title="untitled_$(ls | wc -l)" +fi + +ffmpeg -hwaccel auto -vaapi_device /dev/dri/renderD128 \ +-f decklink -format_code ntsc -i "Intensity Pro" \ +-c:v hevc_vaapi \ +-vf "yadif,format=nv12,hwupload" \ +-c:a libopus -b:a 384k \ +-metadata "title"="$1$title" \ +"$1$title.mkv" diff --git a/old/settitle b/old/settitle new file mode 100755 index 0000000..7cdd7d1 --- /dev/null +++ b/old/settitle @@ -0,0 +1,4 @@ +#!/bin/sh +xdotool set_window --class "$2" $(xdotool search --pid $1) # command chaining doesnt work for some reason +#xdotool getactivewindow set_window --class "$1" +#[ -z "$2" ] && echo -n "\e]0;$2\a" diff --git a/old/setup b/old/setup new file mode 100755 index 0000000..eaeec39 --- /dev/null +++ b/old/setup @@ -0,0 +1,76 @@ +#!/bin/sh + +#interactiveopt() { +# # Usage: interactiveopt "options" "prompt" +# echo "$1" | nl -s': ' 1>&2 +# # Parse user input +# read -p "$2" choices 1>&2 \ +# && choices="$(echo $choices | cut -d' ' -f1-)" +# for choice in $choices; do +# case "$choice" in +# [0-9]*) opt="$opt $(echo "$1" | head -"$(echo $choice | tr -cd '[:digit:]')" | tail -1)";; +# *) echo "Invalid option \"$opt\"" 1>&2 ;; +# esac +# done +# echo "$opt" +#} + +# Open as root in pcmanfm +pcmanfmconf() { + pcmanfmroot=~/.local/share/file-manager/actions + mkdir -p $pcmanfmroot + echo " [Desktop Entry] +Type=Action +Tooltip=Open Folder As Root +Name=Open Folder As Root +Profiles=profile-zero; +Icon=gtk-dialog-authentication + +[X-Action-Profile profile-zero] +MimeTypes=inode/directory; +Exec=/home/timmy/.local/bin/x11/xsudo /usr/bin/pcmanfm %u +Name=Default profile" > $pcmanfmroot/root.desktop +} + +minticons() { + gitdir="/tmp/mint-y-icons" + iconsdir="$gitdir/usr/share/icons" + git clone https://github.com/linuxmint/mint-y-icons.git "$gitdir" + #iconsets="$(interactiveopt "$(ls "$iconsdir")" "Choose icon sets (if using dark theme, COPY THE NON-DARK THEME TOO): ")" + #iconsets="$iconset Mint-Y" + #for iconset in $iconsets; do + # mv "$iconsdir/$iconset" $iconsdestdir + #done + mv $iconsdir/* $iconsdestdir + gtk-update-icon-cache +} + +mintthemes() { + gitdir="/tmp/mint-themes" + themesdir="$gitdir/usr/share/themes" + #iconsdir="$gitdir/usr/share/icons" + git clone https://github.com/linuxmint/mint-themes.git "$gitdir" + curdir="$(pwd)" + cd $gitdir + make + #themes="$(interactiveopt "$(ls "$themesdir")" "Choose themes: ")" + ##iconset="$iconset Mint-Y" + #for theme in $themes; do + # mv "$themesdir/$theme" $themesdestdir + #done + #iconsets="$(interactiveopt "$(ls "$iconsdir")" "Choose icon set (if using dark theme, COPY THE NON-DARK THEME TOO): ")" + #iconset="$iconset Mint-Y" + #for iconset in $iconsets; do + # mv "$iconsdir/$iconset" $iconsdestdir + #done + #gtk-update-icon-cache + mv $themesdir/* $themesdestdir +} + +iconsdestdir=/usr/share/icons +themesdestdir=/usr/share/themes +mkdir -p $iconsdestdir $themesdestdir + +pcmanfmconf +minticons +mintthemes diff --git a/old/speedtest b/old/speedtest new file mode 100755 index 0000000..913f9ef --- /dev/null +++ b/old/speedtest @@ -0,0 +1,8 @@ +#!/usr/bin/python3.9 +# -*- coding: utf-8 -*- +import re +import sys +from speedtest import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/old/speedtest-cli b/old/speedtest-cli new file mode 100755 index 0000000..913f9ef --- /dev/null +++ b/old/speedtest-cli @@ -0,0 +1,8 @@ +#!/usr/bin/python3.9 +# -*- coding: utf-8 -*- +import re +import sys +from speedtest import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/old/testtimmywm b/old/testtimmywm new file mode 100755 index 0000000..33cda37 --- /dev/null +++ b/old/testtimmywm @@ -0,0 +1,5 @@ +#!/bin/sh +Xephyr -br -ac -reset -screen 2160x1440 :1 & +sleep 1 +export DISPLAY=:1 +timmywm & diff --git a/old/transtape b/old/transtape new file mode 100755 index 0000000..a0eaaee --- /dev/null +++ b/old/transtape @@ -0,0 +1,11 @@ +#!/bin/sh +if [ -z "$1" ]; then + exit +fi + +ffmpeg -hwaccel auto -vaapi_device /dev/dri/renderD128 \ +-i "$1" \ +-c:v hevc_vaapi \ +-vf "yadif,format=nv12,hwupload" \ +-metadata "title"="$1" \ +"$1as.mkv" diff --git a/old/viewintensitypro b/old/viewintensitypro new file mode 100755 index 0000000..1b1f77c --- /dev/null +++ b/old/viewintensitypro @@ -0,0 +1,4 @@ +#!/bin/sh +ffplay \ +-f decklink -format_code ntsc -i "Intensity Pro" \ +-vf yadif diff --git a/old/webcamdesktopffplay b/old/webcamdesktopffplay new file mode 100755 index 0000000..c56d879 --- /dev/null +++ b/old/webcamdesktopffplay @@ -0,0 +1,2 @@ +#!/bin/sh +ffplay -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 30 -i /dev/video0 diff --git a/old/win10 b/old/win10 new file mode 100755 index 0000000..130df5c --- /dev/null +++ b/old/win10 @@ -0,0 +1,4 @@ +#!/bin/sh +doas chown -R timmy:timmy /dev/shm +virsh start win10-clone +looking-glass-client -F diff --git a/old/ytdl-dlplst b/old/ytdl-dlplst new file mode 100755 index 0000000..f7b4a47 --- /dev/null +++ b/old/ytdl-dlplst @@ -0,0 +1,5 @@ +#!/bin/sh +echo "Getting Video ID's..." +for id in $(youtube-dl --get-id "$1"); do + youtube-dl --newline "https://youtu.be/$id" & +done diff --git a/pkgmgt/xbps/xs b/pkgmgt/xbps/xs deleted file mode 100755 index 31782ef..0000000 --- a/pkgmgt/xbps/xs +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -voidpkgsdir=~/.local/share/src/tjk-void-packages -srcpkgsdir=$voidpkgsdir/srcpkgs -pkgs="brave-bin" -expkgs="brave-bin" # Extra packages installed in the srcpkgs directory that need to be separately updated through git -gp() { git pull --verbose; } - -cd $voidpkgsdir -gp - -if [ -n $expkgs ]; then - cd $srcpkgsdir - for repo in "$expkgs"; do - cd $repo && gp - cd $srcpkgsdir - done -fi - -cd $voidpkgsdir -./xbps-src binary-bootstrap -./xbps-src pkg $pkgs -doas xbps-install --repository=hostdir/binpkgs $pkgs diff --git a/video/ffconcat b/video/ffconcat deleted file mode 100755 index 06eb066..0000000 --- a/video/ffconcat +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -ffconcat="$(ls | sed "s/^/file '/; s/$/'/")" -echo "$ffconcat" > ffconcat - -ffmpeg \ - -f concat \ - -safe 0 \ - -i ffconcat \ - -c copy \ - out.mkv - -rm ffconcat diff --git a/video/rectape b/video/rectape deleted file mode 100755 index 1e54370..0000000 --- a/video/rectape +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -if [ -z "$1" ]; then - $1=untitled_$(ls | wc -l) -fi - -ffmpeg \ --f decklink -format_code ntsc -i "Intensity Pro" \ --c:v libx264 \ --qmin 6 -qmax 26 -qdiff 4 \ --vf yadif \ --c:a aac -b:a 384k \ --metadata "title"="$1" \ -"$1.mkv" diff --git a/video/rectapevaapi b/video/rectapevaapi deleted file mode 100755 index 16bd190..0000000 --- a/video/rectapevaapi +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -if [ -z "$1" ]; then - title="untitled_$(ls | wc -l)" -fi - -ffmpeg -hwaccel auto -vaapi_device /dev/dri/renderD128 \ --f decklink -format_code ntsc -i "Intensity Pro" \ --c:v hevc_vaapi \ --vf "yadif,format=nv12,hwupload" \ --c:a libopus -b:a 384k \ --metadata "title"="$1$title" \ -"$1$title.mkv" diff --git a/video/transtape b/video/transtape deleted file mode 100755 index a0eaaee..0000000 --- a/video/transtape +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -if [ -z "$1" ]; then - exit -fi - -ffmpeg -hwaccel auto -vaapi_device /dev/dri/renderD128 \ --i "$1" \ --c:v hevc_vaapi \ --vf "yadif,format=nv12,hwupload" \ --metadata "title"="$1" \ -"$1as.mkv" diff --git a/video/viewintensitypro b/video/viewintensitypro deleted file mode 100755 index 1b1f77c..0000000 --- a/video/viewintensitypro +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -ffplay \ --f decklink -format_code ntsc -i "Intensity Pro" \ --vf yadif diff --git a/video/webcamdesktopffplay b/video/webcamdesktopffplay deleted file mode 100755 index c56d879..0000000 --- a/video/webcamdesktopffplay +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -ffplay -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 30 -i /dev/video0 diff --git a/video/win10 b/video/win10 deleted file mode 100755 index 8e5fbbc..0000000 --- a/video/win10 +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -sudo chown -R timmy:timmy /dev/shm -virsh start win10-clone -looking-glass-client -F diff --git a/video/ytdl-dlplst b/video/ytdl-dlplst deleted file mode 100755 index f7b4a47..0000000 --- a/video/ytdl-dlplst +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -echo "Getting Video ID's..." -for id in $(youtube-dl --get-id "$1"); do - youtube-dl --newline "https://youtu.be/$id" & -done diff --git a/x11/bsdtpscroll b/x11/bsdtpscroll deleted file mode 100755 index 0f2cd20..0000000 --- a/x11/bsdtpscroll +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation" 1 -xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Button" 2 -xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Axes" 6 7 4 5 diff --git a/x11/capsmap b/x11/capsmap deleted file mode 100755 index 36c5eb1..0000000 --- a/x11/capsmap +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# Remap caps to super when held -setxkbmap -option caps:super -# Remap caps to escape when pressed -killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape' - -# Turn off caps lock, just in case it was on prior -xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock diff --git a/x11/settitle b/x11/settitle deleted file mode 100755 index 7cdd7d1..0000000 --- a/x11/settitle +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -xdotool set_window --class "$2" $(xdotool search --pid $1) # command chaining doesnt work for some reason -#xdotool getactivewindow set_window --class "$1" -#[ -z "$2" ] && echo -n "\e]0;$2\a" diff --git a/x11/testtimmywm b/x11/testtimmywm deleted file mode 100755 index 33cda37..0000000 --- a/x11/testtimmywm +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -Xephyr -br -ac -reset -screen 2160x1440 :1 & -sleep 1 -export DISPLAY=:1 -timmywm & diff --git a/x11/xkeyconf b/x11/xkeyconf new file mode 100755 index 0000000..cea356f --- /dev/null +++ b/x11/xkeyconf @@ -0,0 +1,12 @@ +#!/bin/sh +# Faster repeated keys and less delay before repeating +xset r rate 250 50 & + +# Remap caps to super when held +setxkbmap -option caps:super + +# Remap caps to escape when pressed +killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape' + +# Turn off caps lock, just in case it was on prior +xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock -- cgit v1.2.3