diff options
author | Tim Keller <tjkeller.xyz> | 2024-11-17 23:39:40 -0600 |
---|---|---|
committer | Tim Keller <tjkeller.xyz> | 2024-11-17 23:39:40 -0600 |
commit | 08f22ad82edbe30606a8145a01ab18f2f6d71b4b (patch) | |
tree | cce5c45c996d81d131ada2f409a3c6d041b5416e /.old | |
parent | 09ada24d4ec23cf24ab136141b354953d1bbc2fa (diff) | |
download | scripts-08f22ad82edbe30606a8145a01ab18f2f6d71b4b.tar.xz scripts-08f22ad82edbe30606a8145a01ab18f2f6d71b4b.zip |
delete .old dir since all is still stored in version control
Diffstat (limited to '.old')
53 files changed, 0 insertions, 1497 deletions
diff --git a/.old/addnetwork b/.old/addnetwork deleted file mode 100755 index 7918985..0000000 --- a/.old/addnetwork +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -#if ssid=`doas iw dev $wifidev scan | sed '/SSID: .\+/!d;/x00/d;s/.*SSID: //' | dmenu -p "Choose Network to Connect to: "` \ -if ssid=`doas iw dev $WIFIDEV scan | sed '/SSID: .\+/!d;/x00/d;s/.*SSID: //' | dmenu -p "Choose Network to Connect to: "` \ -&& [ -n "$ssid" ] \ -&& pass=`dmenu -p "Enter Password for $ssid: " <&-` \ -&& [ -n "$pass" ] -then - wpa_passphrase "$ssid" "$pass" | doas tee -a "/etc/wpa_supplicant/wpa_supplicant.conf" \ - && doas sv restart dhcpcd \ - && dunstify "Network Added" "Network \"$ssid\" Added to wpa_supplicant.conf and restarted the dhcpcd service!" \ - || dunstify "Error" "An error has occured" -fi diff --git a/.old/bsdtpscroll b/.old/bsdtpscroll deleted file mode 100755 index 0f2cd20..0000000 --- a/.old/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/.old/d8concat b/.old/d8concat deleted file mode 100755 index bf8b608..0000000 --- a/.old/d8concat +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh - -[ -d "$1" ] || exit 1 # Exit with error if not pointing to a directory - -# Misc -duration() { ffprobe -i "$1" -show_entries format=duration -v quiet -of csv="p=0" | tr -d . ; } -timebase="1/1000000" # duration function gives microseconds - -safename() { echo "$1" | tr -d '<>:"/\|?*' ; } - -# Temp dirs -workdir="$(mktemp -d "${TMPDIR:-/tmp}/combinetapesworkdir.XXXXXX")" - -cleanup() { rm -rf "$workdir" ; } -trap cleanup EXIT INT HUP QUIT TERM ALRM USR1 - -# Loop vars -current_date=0 -duration_total=0 -chapter_start=0 -chapter_time=0 -last_chapter_concurrent=0 - -# TODO this relys on the for loop looping in order - -# Either can be ran on single dv containing directory, or many dv containing directories -for dir in "$1"/ "$1"/*/; do - dir="${dir%/}" # Remove trailing slash - title="" - - if [ "$dir" != "$1" ]; then - title="$(basename "$dir")" - fi - if echo "$dir" | grep '/\*' >/dev/null; then - break - fi - - for tape in "$dir"/*.dv; do - date="$(echo "$(basename "$tape")" | grep -o '[0-9]*\.[0-9]*\.[0-9]*' | tr '.' '-')" - time="$(echo "$(basename "$tape")" | grep -o '[0-9]*-[0-9]*-[0-9]*' | tr '-' ':')" - - if [ "$title$date" != "$current_date" ]; then - # Reset vars - current_date="$title$date" - duration_total=0 - chapter_start=0 - chapter_time=0 - last_chapter_concurrent=0 - - # Create dirs - date_dir="$workdir/$current_date" - mkdir -p "$date_dir" - - files="$date_dir/files" - chapters="$date_dir/chapters" - - # Init chapters file - printf ";FFMETADATA1\n\n" > "$chapters" - - # title file - if [ "$title" ]; then - echo "$title" > "$date_dir/title" - fi - fi - - # Concat files - echo "file '$(realpath "$tape" | sed "s/'/'\\\\''/g")'" >> "$files" - - # Chapter marker - tape_duration=$(duration "$tape" | grep -o "[1-9][0-9]*") - duration_total=$(( $duration_total + $tape_duration )) - - # Only insert chapter marker if recordings are not concurrent. dvgrab - # splits files into 1gb chunks, or 291557933 microseconds of raw dv footage - # (with digital 8) - if [ $last_chapter_concurrent = 0 ]; then - chapter_time=$time - fi - if [ $tape_duration = 291557933 ]; then - last_chapter_concurrent=1 - continue - else - last_chapter_concurrent=0 - fi - - echo "[CHAPTER]" >> "$chapters" - echo "TIMEBASE=$timebase" >> "$chapters" - echo "START=$chapter_start" >> "$chapters" - echo "END=$duration_total" >> "$chapters" - echo "title=Section starts at $chapter_time" >> "$chapters" - echo >> "$chapters" - - chapter_start=$duration_total - done -done - - -# ffmpeg combine -out_dir=export -default_title=Untitled -mkdir -p "$out_dir" - -for date_dir in "$workdir"/*; do - date="$(echo "$date_dir" | grep -o "[0-9][0-9][0-9][0-9]-[0-9]*-[0-9]*")" - origin_tape="$(basename "$1")" - - # Files - title="$date_dir/title" - files="$date_dir/files" - chapters="$date_dir/chapters" - - # Nicely title - if [ -e "$title" ]; then - # title file - output_title="$(cat "$title")" - #elif echo "$origin_tape" | grep "^[^0-9].*[0-9]*-[0-9]*-[0-9]*" >/dev/null; then - # # Beginning descriptor - # output_title="$(echo "$origin_tape" | sed 's/ [0-9#].*//')" - #elif echo "$origin_tape" | grep "$date [A-Z]" >/dev/null; then - # # Date range or list of dates with titles (Title must be capitalized, 'to' must be made lowercase - # output_title="$(echo "$origin_tape" | sed "s/.*$date //; s/ to [0-9].*//; s/;.*//")" - else - # default - output_title=$default_title - fi - - output_title="$(echo "$output_title" | sed 's/\s*#[0-9]*$//')" # Remove sequence numbers - - # File name - if [ "$output_title" = "$default_title" ]; then - output_name="$date" - else - output_name="$date $output_title" - fi - - if [ -e "$out_dir/$output_name.mp4" ]; then - output=$(ls "$out_dir" | grep "$output_name *[0-9]*.mp4" | while read -r file; do - file_tape="$(mediainfo "$out_dir/$file" | sed -n 's/Comment.* - Origin tape: //p')" - if [ "$origin_tape" = "$file_tape" ]; then - echo 0 - break - fi - done) - if [ "$output" = 0 ]; then - continue - fi - output_name="$output_name $(ls "$out_dir" | grep "$output_name *[0-9]*.mp4" | wc -l)" - fi - - # Convert - #-c copy \ - #-metadata "title=$output_title" \ # Dont set title since it will be stuck if file is renamed - ffmpeg -hide_banner -nostdin \ - -n \ - -f concat -safe 0 -i "$files" \ - -i "$chapters" -map_metadata 1 \ - -c:v libx264 -crf 22 -preset medium -tune grain \ - -vf yadif \ - -c:a aac -b:a 320k \ - -metadata "date=$date" \ - -metadata "comment=tapes.tjkeller.xyz - Origin tape: $origin_tape" \ - "$out_dir/$output_name.mp4" - #"$out_dir/$output_name.mkv" -done diff --git a/.old/d8integrity b/.old/d8integrity deleted file mode 100755 index 717032b..0000000 --- a/.old/d8integrity +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -find . -type f -name "*.dv" | while read file; do - ffmpeg -v error -i "$file" 2>&1 | grep "Concealing bitstream errors" >/dev/null && echo "$file" -done - -find . -type f -name "*.dv" | while read file; do - ffmpeg -v error -i "$file" -f null - 2>&1 | grep "Concealing bitstream errors" >/dev/null && echo "$file" -done diff --git a/.old/delsimpic b/.old/delsimpic deleted file mode 100755 index 83c3d1a..0000000 --- a/.old/delsimpic +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/awk -f -function convtobytes(num) { - if (match(num, " K")) - mul = 1000 - else if (match(num, " M")) - mul = 1000 * 1000 - else if (match(num, " G")) - mul = 1000 * 1000 * 1000 - else - mul = 1 - return int(num * mul) -} - -BEGIN { - cmd = "czkawka_cli image -d $PWD" - FS = " - " - largestsize = 0 - imc = 0 - k = 0 - while (cmd | getline) { - print $0 - if (!match($0, "^/")) { - delete images - largestsize = 0 - imc = 0 - k++ - break - } - images[$imc] = $0 - if (size = convtobytes($3) > largestsize) { - largestsize = size - keep[$k] = $1 - } - imc++ - } - for (image in keep) { - print $image - } -} diff --git a/.old/dmenu_runapp b/.old/dmenu_runapp deleted file mode 100755 index 4d7a45e..0000000 --- a/.old/dmenu_runapp +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -apps="$(echo ${XDG_DATA_DIRS:-/usr/share}: | sed 's/:/\/applications\/*.desktop /g')" -name="$(grep -Rhm1 '^Name=' $apps 2>/dev/null | cut -d'=' -f2- | sort | uniq | dmenu "$@")" -[ -n "$name" ] && gtk-launch $(basename `grep -Rlm1 "^Name=$name$" $apps 2>/dev/null`) & diff --git a/.old/dmenunametag b/.old/dmenunametag deleted file mode 100755 index 0458c79..0000000 --- a/.old/dmenunametag +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -numtags=9 -rcn="Remove Current Name" -defnames="$rcn\nCode\nCompile\nTest\nDebug\nEdit" -while !([ $tagnum -ge 1 2>/dev/null ] && [ $tagnum -le $numtags ]); do - tagnum=$(seq $numtags | dmenu -p "Choose tag: ") - [ "$tagnum" = "" ] && exit -done -name="$(echo -n "$defnames" | dmenu -p "Rename tag $tagnum to: ")" -[ "$name" = "$rcn" ] \ - && nametag $tagnum r \ - || nametag $tagnum n "$name" - -# Force bar to update by setting the root name to itself since there is currently a bug in the window manager -#xsetroot -name "$(xprop -root WM_NAME | sed -n 's/^WM_NAME(STRING) = \"\(.*\)\"/\1/p')" - -# Old mode -#while [ "$action" != "Rename" ] && [ "$action" != "Remove" ]; do -# action=$(echo -n "Rename\nRemove" | dmenu -p "Would you like to rename or remove this tag $tagnum's label? ") -# [ "$action" = "" ] && exit -#done -#case $action in -# Rename) -# name="$(echo -n "$defnames" | dmenu -p "Rename tag $tagnum to: ")" -# [ "$name" = "" ] && exit -# nametag $tagnum n "$name" -# ;; -# Remove) nametag $tagnum r ;; -# *) exit ;; -#esac diff --git a/.old/dnfu b/.old/dnfu deleted file mode 100755 index 9f6a9cb..0000000 --- a/.old/dnfu +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -sudo ln -sf /bin/bash /bin/sh - -sudo dnf update $@ - -sudo dnf remove $@ --oldinstallonly --setopt installonly_limit=2 kernel - -sudo dnf autoremove $@ - -sudo ln -sf /bin/dash /bin/sh diff --git a/.old/dockfanctl b/.old/dockfanctl deleted file mode 100755 index f422b3e..0000000 --- a/.old/dockfanctl +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -hub=$(doas uhubctl | grep -B3 'Port 3: .* highspeed enable connect .* Lenovo USB2.0 Hub' | grep -o -m1 '[0-9][^ ]*' | head -n1) -! [ "$hub" ] && exit 1 - -echo $hub - -case $1 in - off) doas uhubctl -a off -p 4 -l $hub ;; - on) doas uhubctl -a on -p 4 -l $hub ;; -esac diff --git a/.old/dvgrabscript b/.old/dvgrabscript deleted file mode 100644 index d82ba55..0000000 --- a/.old/dvgrabscript +++ /dev/null @@ -1 +0,0 @@ -sudo dvgrab -autosplit -rewind -timestamp -format raw -csize 100000000 diff --git a/.old/emu b/.old/emu deleted file mode 100755 index 87c0e2a..0000000 --- a/.old/emu +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# This only works for collections with a common extension. You can rename all your roms to use the same extension and (in any decent emulator at least) they should work regardless of the actual header type -gamedir=${XDG_DATA_HOME:-$HOME/.local/share}/games -dmenuprompt="dmenu -l 25" -resolution() { cat /sys/class/drm/*/modes | head -1; } -case "$1" in - 2600) - #dmenucolors="-nb #111 -nf #e4963c -sb #6c3b17 -sf #fff -nhb #121212 -nhf #fc5231 -shb #804f2d -shf #fc5231" - dmenucolors="-nb #111 -nf #e4963c -sb #6c3b17 -sf #fff" - emulator="stella" - ext=bin - ;; - 3ds) - #dmenucolors="-nb #111 -nf #888 -sb #999 -sf #F00 -nhb #111 -nhf #fff -shb #999" - dmenucolors="-nb #111 -nf #888 -sb #999 -sf #F00" - emulator="citra" - ext=3ds - ;; - nes) - #dmenucolors="-nb #6d6a6d -nf #fff -sb #dfdcdd -sf #c1121c -nhb #222 -nhf #dc444d -shb #a29fa3 -shf #dc444d" - dmenucolors="-nb #6d6a6d -nf #fff -sb #dfdcdd -sf #c1121c" - emulator="fceux" - ext=nes - ;; - snes) - #dmenucolors="-nb #b2b4b2 -nf #000 -sb #514689 -sf #fff -nhb #707372 -nhf #fff -shb #a7a4e0 -shf #000" - dmenucolors="-nb #b2b4b2 -nf #000 -sb #514689 -sf #fff" - emulator="launch snes" - ext=sfc - ;; - n64) - #dmenucolors="-nb #223 -nf #fff -sb #069330 -sf #fff -nhb #c20d02 -nhf #ffc001 -shb #011da9 -shf #ffc001" - dmenucolors="-nb #223 -nf #fff -sb #069330 -sf #fff" - emulator="mupen64plus --fullscreen --gfx mupen64plus-video-glide64mk2 --resolution $(resolution)" - ext=z64 - ;; - gcn) - #dmenucolors="-nb #4d3b7c -nf #ddd -sb #000 -sf #fff -nhb #4d3b7c -nhf #eba982 -shb #000 -shf #eba982" - dmenucolors="-nb #4d3b7c -nf #ddd -sb #000 -sf #fff" - emulator="dolphin-emu -b" - ext=iso - ;; - nds) - #dmenucolors="-nb #ccc -nf #000 -sb #52398d -sf #fff -nhb #888 -nhf #fff -shb #52398d" - dmenucolors="-nb #ccc -nf #000 -sb #52398d -sf #fff" - emulator="desmume --3d-engine 2" - ext=nds - ;; - *) - console=`ls $gamedir | dmenu -l 25` && ($0 $console || $0) # Allows going back to select a different console - exit - ;; -esac - -gamedir="$gamedir/$1" && [ -e "$gamedir" ] \ - && selgame="`ls "$gamedir" | sed -n "s/\.$ext$//p" | $dmenuprompt $dmenucolors`.$ext" \ - && $emulator "$gamedir/$selgame" diff --git a/.old/enablecoredumps b/.old/enablecoredumps deleted file mode 100755 index e435cc7..0000000 --- a/.old/enablecoredumps +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -ulimit -c unlimited -sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t diff --git a/.old/ffconcat b/.old/ffconcat deleted file mode 100755 index 06eb066..0000000 --- a/.old/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/.old/hwtexedit b/.old/hwtexedit deleted file mode 100755 index 262d10b..0000000 --- a/.old/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/.old/lipsum b/.old/lipsum deleted file mode 100755 index 7ae9b7e..0000000 --- a/.old/lipsum +++ /dev/null @@ -1,87 +0,0 @@ -#!/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() { - sub(/./, toupper(substr($0, 0, 1))) -} - -function randrange(min, max) { - return int((rand() * (max - min)) + min) -} - -function isint(arg) { - return arg ~ /^[0-9]+$/ -} - -function genwords(words, cmd) { - if (words > 0 && cmd | getline) { - capitalize(); print - for (i = 1; cmd | getline && i < words; i++) - print " "$0 - print "\n" - } -} - -function gensentences(sentences, delim, cmd, min, max) { - for (; sentences > 0 && cmd | getline; sentences--) { - capitalize(); print - words = randrange(min, max) # Isn't possible to initialize or increment multiple variables in awk for loops - for (i = 1; cmd | getline && i < words; i++) - print (rand() < 0.10 ? ", " : " ")$0 - print delim - } -} - -function genparagraphs(paragraphs, cmd, min, max) { - for (; paragraphs > 0; paragraphs--) { - print "\t" - gensentences(randrange(6, 10), ". ", cmd, min, max) - print "\n" - } -} - -BEGIN { - dictionary = "/home/timmy/.local/share/lorem-ipsum-dictionary" # List of lorem ipsum words separated by newlines - cmd = "< "dictionary" shuf -r -n" # Command to generate random permutations of words from dictionary separated by newlines - echolorem = "echo -n 'lorem\nipsum\ndolor\nsit\namet\n'" - - ORS = "" - srand() - - # Parse Arguments - !isint(ARGV[1]) && ARGV[1] && printusage() - numof = ARGC > 1 ? ARGV[1] : 5 - mode = ARGC > 2 ? ARGV[2] : "p" - litext = 1 - if (ARGV[3]) - switch (ARGV[3]) { - case /^1$|^t$|^true$/: litext = 1; break - case /^0$|^f$|^false$/: litext = 0; break - default: printusage() - } - litext && cmd = echolorem "&&" cmd - min = isint(ARGV[4]) ? ARGV[4] : 5 - max = isint(ARGV[5]) ? ARGV[5] : 12 - - switch (mode) { - case /^w$|^words$/: - cmd = cmd numof - genwords(numof, cmd) - break - case /^s$|^sentences$/: - cmd = cmd (max * numof) - gensentences(numof, ".\n", cmd, min, max) - break - case /^p$|^paragraphs$/: - cmd = cmd (max * 10 * numof) - genparagraphs(numof, cmd, min, max) - break - default: - printusage() - } - close(cmd) -} diff --git a/.old/lipsum.~1~ b/.old/lipsum.~1~ deleted file mode 100755 index efa71b5..0000000 --- a/.old/lipsum.~1~ +++ /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/.old/lipsumsh b/.old/lipsumsh deleted file mode 100755 index d229877..0000000 --- a/.old/lipsumsh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh - -dictionary=/home/timmy/.local/share/lorem-ipsum-dictionary - -shuf -r -n$1 $dictionary | awk -f- hi hello yolo <<'AWKSCRIPT' -BEGIN { for(i = 1; i < ARGC; i++) print ARGV[i] } -AWKSCRIPT -echo -#shuf -r -n$1 $dictionary | tr '\n' ' ' - - - - - -exit - -#genipsums() { shuf -r -n$1 $dictionary | tr '\n' ' ' | sed 's/.$//'; } -genipsums() { shuf -r -n$1 $dictionary; } -gensentence() { genipsums $1 | sed ':a;N;$!ba; s/\n/ /g; s/.$//; s/\(^\| \)\([a-z]\)/\1\u\2/'; } - -genparagraph() { - sentences=`shuf -n1 -i 4-12` - echo -n '\t' - - for i in `seq $sentences`; do - words=`shuf -n1 -i 1-10` - [ "$loremipsumtext" = '1' ] && echo -n "Lorem ipsum " && genipsums $words && loremipsumtext=0 || gensentence $words - [ "$words" -le 4 ] || [ `shuf -n1 -i 0-2` = 1 ] && echo -n ', ' && genipsums `shuf -n1 -i 3-10` # make more complex - echo -n '. ' - done - echo -} - -loremipsumtext=1 - -genparagraph - - - -#exit -# -#dictionary=/home/timmy/.local/share/lorem-ipsum-dictionary -# -#ipsums=$1 -# -##set -- `tr '\n' ' ' < $dictionary` -#set -- `cat $dictionary` -# -##rand=`od -An -N$ipsums /dev/urandom` -# -#shuf -r -n$ipsums -i 1-$# | while read line; do -# eval echo -n \${$line} -# echo -n ' ' -#done -# -#echo -# -#exit -# -# -# -#words=`wc -w $dictionary | cut -d' ' -f1` -# -#echo -n '\tLorem ipsum ' -# -#shuf -r -n$1 -i 1-$words | while read line; do -# #cut -z -d' ' -f$line $dictionary && echo -n ' ' -# head -n$line $dictionary | tail -n1 | tr -d '\n' -# num=`shuf -n1 -i 1-100` -# ([ "$num" -lt 10 ] && echo -n '. ') || ([ "$num" -gt 90 ] && echo -n ', ') || ([ "$num" = '50' ] && echo -n '.\n\t') || echo -n ' ' -#done -#echo diff --git a/.old/memuse b/.old/memuse deleted file mode 100755 index eb9ffde..0000000 --- a/.old/memuse +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/awk -f -function getvar(label) { - while (getline < meminfo && $1 != label":"); - return $2 -} - -BEGIN { - meminfo="/proc/meminfo" - - # Make sure these are in order of the output of /proc/meminfo - memtotal = getvar("MemTotal") - memfree = getvar("MemFree") - buffers = getvar("Buffers") - cached = getvar("Cached") - shmem = getvar("Shmem") - sreclaimable = getvar("SReclaimable") - - # Htop calculations - totalused = memtotal - memfree - totalcached = cached + sreclaimable - shmem - noncachenonbuf = totalused - (buffers + totalcached) - - # Print % of memory used - print int((noncachenonbuf * 100) / memtotal)"%" -} - -#BEGIN { -# cmd="free -b" -# cmd | getline -# cmd | getline -# print int($3*100/$2)"%" -#} -##awk '{ if(!total){ total = $2 } else if(!free){ free = $2 } else{ exit } } END{ print int(((total-free)*100)/total)"%" }' /proc/meminfo diff --git a/.old/mime b/.old/mime deleted file mode 100755 index 7c6a649..0000000 --- a/.old/mime +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -# Media type csv caching -cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mimewiz" -mtypesrc="https://www.iana.org/assignments/media-types" -mtypes="`grep -v '#'`" << TYPES -#application -audio -font -#example -image -#message -#model -#multipart -text -video -TYPES -nmtypes="`cat`" << TYPES -pdf, -spreadsheet ms-excel, -wordprocessing ms-word, -presentation ms-powerpoint, -drawing, -zip gzip, -TYPES - -dlcsv() { curl -sS -C - -o "$2" "$1" || exit; } - -# Download all media type csv's if they're not avaliable -mkdir -p "$cachedir" -for mtype in $mtypes; do - mtypefile="$cachedir/$mtype.csv" - [ -e "$mtypefile" ] || dlcsv "$mtypesrc/$mtype.csv" "$mtypefile" -done - -interactiveopt() { - # Usage: interactiveopt "options" "prompt" "maxopts (if unset than equal to inf)" "col" - # Purpose: give the user a numbered list of options. User can specify multiple choices. User can specify either the number or the name of the option. - # Output: saved in variable "opt" - unset opt # This won't be set if using recursion, do it in a while loop instead - while [ -z $opt ] 2>/dev/null; do - # Column option - [ -n "$4" ] && [ "$4" = "col" ] \ - && echo "$1" | nl -s': ' | column \ - || echo "$1" | nl -s': ' - # Parse user input - read -p "$2" choices \ - && choices="$(echo $choices | cut -d' ' -f1-$3)" - for choice in $choices; do - case "$choice" in - [0-9]*) opt="$(echo "$1" | head -"$(echo $choice | tr -cd '[:digit:]')" | tail -1) $opt" ;; - *) opt="$(echo "$1" | grep "^$choice$" 2>/dev/null) $opt" ;; - esac || ( echo "Invalid option \"$choice\"" && undet opt && break ) # Why wont this unset opt or break??????? - done - done -} - - -# Choose mimetype: -mtypes="$mtypes\n$(echo "$nmtypes" | cut -d',' -f1)" -interactiveopt "$mtypes" "Choose mimetype: " 1 -mtype="$(echo "$opt" | cut -d' ' -f1)" -echo "$mtype" -echo - -# Choose subtype -mtypefile="$cachedir/$mtype.csv" -[ -e "$mtypefile" ] && interactiveopt "all\n$(cut -d',' -f1 "$mtypefile" | tail -n +2)" "Choose $mtype subtype: " "" col -mfiletypes=" $opt " -echo - -# Choose program -interactiveopt "$(ls /usr/share/applications | sed 's/\.desktop//')" "Choose program to open with: " "" col -program="$opt" -echo "$program" -echo - -#echo "$mfiletypes" | grep ' all ' && mfiletypes="$(cut -d',' -f1 "$cachedir/$mtype.csv" | tail -n +2)" - -# Xdg-mime commands -#cut -d',' -f2 "$cachedir/image.csv" - -for mfiletype in $(cut -d',' -f1 "$cachedir/$mtype.csv" | tail -n +2); do - echo "Changing default program for $mfiletype to $program" - xdg-mime default "$program.desktop" $mfiletype -done diff --git a/.old/mnt b/.old/mnt deleted file mode 100755 index 7547912..0000000 --- a/.old/mnt +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# '/part\s*$\|rom\s*$/!d; s/\s*[^[:space:]]*\s*$/\)/; s/\s/ \(/' # More correct in my opinion, but slower -if partition=`lsblk -npro "name,size,type,mountpoint" | sed '/part $\|rom $/!d; s/ [a-z]* $/\)/; s/ / \(/' | dmenu -p "Choose drive to mount: " | cut -d' ' -f1` \ -&& [ -n "$partition" ] \ -&& mountpoint=`ls -d /media/mnt/slot*/ | dmenu -p "Choose mountpoint: "` \ -&& [ -n "$mountpoint" ] -then - doas mount "$partition" "$mountpoint"; user="$(whoami)"; ug="$(groups | cut -d' ' -f1)"; doas chown "$user":"$ug" "$mountpoint" \ - && notify-send --urgency low "Device Successfully Mounted" "Successfully Mounted partition \"$partition\" to mountpoint \"$mountpoint\"" \ - || notify-send --urgency low "Error Mounting Device" "Could not mount partition \"$partition\" to mountpoint \"$mountpoint\"" -fi diff --git a/.old/music b/.old/music deleted file mode 100755 index cb78257..0000000 --- a/.old/music +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -albumsdir=/media/4tbhdd/Music -dmenucolors="-l 25" - -playsong() { - list="`find $albumsdir -type f -name '*mka' | sort | sed 's/.*\/\(.*\) - \(.*\)\/[0-9]*: \(.*\).mka$/\3\t\1\t\2/' | awk -F '\t' '{ printf "%-120s %-60s %s\n", $1, $2, $3 }'`" - selection="`echo "$list" | dmenu $dmenucolors -p 'Song:'`" - selection="`echo "$selection" | sed 's/\(.*\) *\(.*\) *\(.*\)/\2 - \3\/[0-9]*: \1-/'`" - echo "$selection" -} - -playalbum() { - list="`find $albumsdir -type d -mindepth 1 -maxdepth 1 | sort`" -} - -playartist() { - list="`find $albumsdir -type d -mindepth 1 -maxdepth 1 | sed 's/ - .*//' | sort | uniq`" - artist= - list="`find $albumsdir -type d -name "$artist*" | sort`" -} - -playshuffle() { - list="`find $albumsdir -type f -name "*mka" | sort -R`" -} - -playsong -#play="`echo "$list" | grep "$selection"`" -#echo "$play" diff --git a/.old/netstat b/.old/netstat deleted file mode 100755 index e7b23c3..0000000 --- a/.old/netstat +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/awk -f - -BEGIN { -wifidev=ENVIRON["WIFIDEV"] -ethedev=ENVIRON["ETHEDEV"] -getline state < ("/sys/class/net/"ethedev"/operstate") -switch (state) { - case "up": - print "" - break - case "down": - getline state < ("/sys/class/net/"wifidev"/operstate") - switch (state) { - case "up": - # make this nicer, obviously - getline < "/proc/net/wireless" - getline < "/proc/net/wireless" - getline < "/proc/net/wireless" - sigstrength=int($3 * 100 / 70) - if (sigstrength > 70) { - print " " sigstrength "%" - } - else if (sigstrength > 40) { - print " " sigstrength "%" - } - else if (sigstrength > 10) { - print " " sigstrength "%" - } - else { - print " " sigstrength "%" - } - break - case "down": - print "" - break - default: - print "Device "wifidev" not found..." - break - } - break - default: - print "Device "ethedev" not found..." - break -} -} diff --git a/.old/rectape b/.old/rectape deleted file mode 100755 index 238f5de..0000000 --- a/.old/rectape +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -if [ -z "$1" ]; then $0 untitled_$(ls | wc -l); exit; fi - -for mod in blackmagic blackmagic-io; do doas modprobe $mod; done -#doas rc-service DesktopVideoHelper start - -ffmpeg \ - -f decklink -format_code ntsc -i "Intensity Pro" \ - -c:v libx264 \ - -preset medium \ - -qmin 6 -qmax 18 -qdiff 4 \ - -vf yadif \ - -c:a aac -b:a 384k \ - -metadata "title"="$1" \ - -metadata "comment=tapes.tjkeller.xyz" \ - "$1.mkv" diff --git a/.old/rectapehevc b/.old/rectapehevc deleted file mode 100755 index c44d6d9..0000000 --- a/.old/rectapehevc +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -if [ -z "$1" ]; then $0 untitled_$(ls | wc -l); exit; fi - -for mod in blackmagic blackmagic-io; do doas modprobe $mod; done -#doas rc-service DesktopVideoHelper start - -ffmpeg \ - -f decklink -format_code ntsc -i "Intensity Pro" \ - -c:v libx265 \ - -qmin 6 -qmax 18 -qdiff 4 \ - -vf yadif \ - -c:a flac \ - -metadata "title"="$1" \ - -metadata "comment=tapes.tjkeller.xyz" \ - "$1.mkv" diff --git a/.old/rectapevaapi b/.old/rectapevaapi deleted file mode 100755 index 91c0709..0000000 --- a/.old/rectapevaapi +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -[ -z "$1" ] && $0 untitled_$(ls | wc -l) - -for mod in blackmagic blackmagic-io; do doas modprobe $mod; done -doas rc-service DesktopVideoHelper start - -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/remnetwork b/.old/remnetwork deleted file mode 100755 index 90a1406..0000000 --- a/.old/remnetwork +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -wpa_supplicant_conf=/etc/wpa_supplicant/wpa_supplicant.conf -notification() { notify-send --urgency low "Forgot Network \"$ssid\"" "Network \"$ssid\" has been removed from $wpa_supplicant_conf"; } -ssid=`doas cat $wpa_supplicant_conf | sed '/ssid/!d; s/\s*ssid=\"//; s/\"$//' | dmenu -p "Choose Network to Forget: "` && \ -[ `echo "No\nYes" | dmenu -p "Are you sure you want to forget \"$ssid\"?"` ] && \ -doas ed $wpa_supplicant_conf << EOF > /dev/null && notification -g/$ssid/-2+,/}/d -w -EOF - diff --git a/.old/sb-internet b/.old/sb-internet deleted file mode 100755 index ee1a160..0000000 --- a/.old/sb-internet +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# Show wifi 📶 and percent strength or 📡 if none. -# Show 🌐 if connected to ethernet or ❎ if none. -# Show 🔒 if a vpn connection is active - -case $BLOCK_BUTTON in - 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; - 3) notify-send "🌐 Internet module" "\- Click to connect -📡: no wifi connection -📶: wifi connection with quality -❎: no ethernet -🌐: ethernet working -🔒: vpn is active -" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in - down) wifiicon="📡 " ;; - up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;; -esac - -printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)" diff --git a/.old/screenrec b/.old/screenrec deleted file mode 100755 index 8f65514..0000000 --- a/.old/screenrec +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -newname() { defname="video"; name=$defname`ls | grep "^$defname[0-9]*" | wc -l | tr -d '[:blank:]'`.mkv; } -[ -z "$1" ] && newname || name="$1" -# Get screen info. I suspect this script wouldn't work too well with multiple screens. Somebody else can add that -resinfo="$(xrandr | grep '*' | tr -s ' ')" -vs="$(echo "$resinfo" | cut -d' ' -f2)" -fr="$(echo "$resinfo" | sed 's/.*\s\([0-9]*\.[0-9]*\)\*.*/\1/')" -# -i is screen coordinates for top-leftmost screen -# Encoder settings are basically lossless and optimized for good speed, decent size, and great quality -# yuv444p colorspace is needed for a 24 bit rgb monitor, change for hdr. yuv420p is the default and is good for video, but is inadequate for screencasts -ffmpeg -hide_banner \ - -video_size $vs \ - -framerate $fr \ - -f x11grab \ - -i :0.0+0,0 \ - -f alsa -channels 1 -sample_rate 48000 \ - -i hw:3 \ - -c:v libx264 \ - -c:a libopus \ - -b:a 128k \ - -preset ultrafast \ - -qp 1 \ - -pix_fmt yuv444p \ - "$name" diff --git a/.old/settitle b/.old/settitle deleted file mode 100755 index 7cdd7d1..0000000 --- a/.old/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/.old/setup b/.old/setup deleted file mode 100755 index bcb0843..0000000 --- a/.old/setup +++ /dev/null @@ -1,79 +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-master" - iconsdir="$gitdir/usr/share/icons" - #git clone https://github.com/linuxmint/mint-y-icons.git "$gitdir" - wget https://github.com/linuxmint/mint-y-icons/archive/refs/heads/master.zip -O "$gitdir.zip" - bsdtar xvf "$gitdir.zip" - #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-master" - themesdir="$gitdir/usr/share/themes" - #iconsdir="$gitdir/usr/share/icons" - wget https://github.com/linuxmint/mint-themes/archive/refs/heads/master.zip -O "$gitdir.zip" - bsdtar xvf "$gitdir.zip" - 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/setwindowtitle b/.old/setwindowtitle deleted file mode 100755 index a2b9218..0000000 --- a/.old/setwindowtitle +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -#windowname="$(dmenu -p 'Enter New Window Name. Then, Select the Window to Change' <&-)" -#xdotool selectwindow set_window --class "$windowname" -##if [ -z "$1" ]; -##then -##else -## xdotool getactivewindow set_window --class "$1" -##fi -#if [ -z "$2" ]; then echo -en "\e]0;$2\a"; fi -#xsetroot -name "" diff --git a/.old/shblr b/.old/shblr deleted file mode 100755 index 4570afc..0000000 --- a/.old/shblr +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -energy_now_total=0 -energy_full_total=0 -for bat in /sys/class/power_supply/BAT?*; do - echo "`basename $bat`: \n" \ - "├─Capacity:\t\t`cat $bat/capacity`% \n" \ - "├─Energy Now:\t\t`cat $bat/energy_now` \n" \ - "├─Energy Full:\t\t`cat $bat/energy_full` \n" \ - "├─Energy Full Design:\t`cat $bat/energy_full_design` \n" \ - "└─Health:\t\t$(( (`cat $bat/energy_full` * 100) / `cat $bat/energy_full_design` ))% " - energy_now_total=$(( energy_now_total + `cat $bat/energy_now` )) - energy_full_total=$(( energy_full_total + `cat $bat/energy_full` )) -done -echo "\nTotal Capacity:\t$(( (energy_now_total * 100) / energy_full_total ))%" diff --git a/.old/shows b/.old/shows deleted file mode 100755 index a0cb8a6..0000000 --- a/.old/shows +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -showsdir=/media/4tbhdd/Videos/Shows -dmenucolors="-l 25" - -playvid() { [ -e "$1" ] && mpv --fullscreen "$1" || exit 1; } - -# Select show -show="`ls "$showsdir" | dmenu $dmenucolors -p "Show:"`" || exit 1 - -# Select season or special option -allep="Show All Episodes" -randep="Play Random Episode" -season="`echo "$allep\n$randep\n$(ls "$showsdir/$show")" | dmenu $dmenucolors -p "Season:"`" || exit 1 - -# Select episode -case "$season" in - $allep) - ep="$(find "$showsdir/$show" -type f | sort | sed 's/.* \([0-9]*\)\/\(.*\)\.mkv$/S\1E\2/' | dmenu $dmenucolors -p "Episode:")" - playvid "$showsdir/$show/$(echo "$ep" | sed 's/^S\([0-9]*\)E/Season \1\//').mkv" - ;; - $randep) playvid "$(find "$showsdir/$show" -type f | shuf -n1)" ;; - *) - ep="$(ls "$showsdir/$show/$season" | sed 's/\.mkv$//' | dmenu $dmenucolors -p "Episode:")" - playvid "$showsdir/$show/$season/$ep.mkv" - ;; -esac diff --git a/.old/sinkold b/.old/sinkold deleted file mode 100755 index 3022963..0000000 --- a/.old/sinkold +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -printusage() { echo "Usage: $0 [<repos> ...] (repos: all,`echo $repos | tr ' ' ','`) [up|down]" && exit; } - -repos="docs patches" - -oper=`echo $@ | sed 's/.* //'` # Get last argument -([ -z $2 ] || ([ "$oper" != "up" ] && [ "$oper" != "down" ])) && printusage - -# rync options -#fix this too -ropts="--archive --partial --progress --recursive --update --verbose" # Equivalent to: -aPrvu --delete -rdest="tjkrsync@tjkeller.xyz:" - -# Colors -BOLD="\033[1m" -NORM="\033[0m" -CYN="\033[0;36m" -RED="\033[0;31m" -GRN="\033[0;32m" - -printsyncmsg() { echo -n "$CYN[Syncing $SYNCNAME...]$NORM\n"; } -printsuccess() { echo -n "$BOLD$GRN[Successfully synced $SYNCNAME]\n"; } -printerror() { echo -n "$BOLD$RED[An error occured while syncing $SYNCNAME]\n"; } - -sync() { - [ $oper = "up" ] && SYNCNAME="$1$2 to $rdest$2" || SYNCNAME="$rdest$2 to $1$2" - printsyncmsg - (if [ $oper = "up" ]; then rsync $ropts $1$2 $rdest; else rsync $ropts --delete $rdest$2 $1; fi) \ - && printsuccess || printerror -} - -# arg1 = options + containing directory path, arg2 = file/directory name -syncdocs() { destdir="" && sync "/home/timmy/docs/" "school"; } -#syncsites() { destdir="" && sync "--exclude=pass /home/timmy/.local/src/" "sites"; } # Excludes password file -syncpatches() { destdir="" && sync "--exclude=.git /home/timmy/.local/src/programs/" "patches"; } # Excludes git files - -for arg in "$@"; do - case $arg in - all) $0 $repos $oper ;; - up|down) oper=$arg ;; - *) # Would like to use something like $repos) here but cant - for repo in $repos; do - [ "$arg" = "$repo" ] && sync$arg && break - done || printusage - ;; - esac -done diff --git a/.old/sinkswitch b/.old/sinkswitch deleted file mode 100755 index 3046498..0000000 --- a/.old/sinkswitch +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -[ $(hostname) != 'T495' ] && echo "Not T495. Exiting" && exit 1 - -status="$(wpctl status)" - -headphones_sink=$(echo "$status" | grep -m1 'ThinkPad USB-C Dock Gen2 USB Audio Analog Stereo \[vol:' | grep -m1 -o '[0-9]*') -speakers_sink=$( echo "$status" | grep -m1 'Raven/Raven2/Fenghuang HDMI/DP Audio Controller Digital Stereo (HDMI 2) \[vol:' | grep -m1 -o '[0-9]*') - -selected_sink=$(echo "$status" | grep -m1 '\*\s*[0-9]*' | grep -o '[0-9]*') - -case $selected_sink in - $headphones_sink) wpctl set-default $speakers_sink && echo "Switched to speakers" ;; - $speakers_sink) wpctl set-default $headphones_sink && echo "Switched to headphones" ;; - *) echo "Cannot find correct sink. Exiting" && exit 1 ;; -esac diff --git a/.old/speedtest b/.old/speedtest deleted file mode 100755 index 913f9ef..0000000 --- a/.old/speedtest +++ /dev/null @@ -1,8 +0,0 @@ -#!/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 deleted file mode 100755 index 913f9ef..0000000 --- a/.old/speedtest-cli +++ /dev/null @@ -1,8 +0,0 @@ -#!/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/sync/griff b/.old/sync/griff deleted file mode 100755 index 549b108..0000000 --- a/.old/sync/griff +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -home=$(echo $HOME | sed 's/\//\\\//g') -repos="$(grep -v '#' | sed "s/\~/$home/")" << REPOS -#~/.local/src/programs/blr -~/.local/src/programs/dmenu -~/.config -~/.local/bin -~/.local/src/programs/st -~/.local/src/programs/timmywm -REPOS -#echo "$repos" | cut -f1 - -# Colors -BOLD="\033[1m" -NORM="\033[0m" -CYN="\033[0;36m" -RED="\033[0;31m" -GRN="\033[0;32m" -MAG="\033[0;35m" - -me() { echo $0 | sed 's/.*\///'; } -repocheck() { [ -z "$repos" ] && echo "No repos have been added!\nUse \"$(me) add\" or edit the script file to add a new repo!" && exit; } - -reponame() { sed -n 's/^\s*url.*\/\(.*\)\.git/\1/p' $1/.git/config; } - -rddiff() { - repocheck - for repo in $repos; do - name="$(reponame $repo)" - if cd $repo 2>/dev/null; then - if git diff --quiet HEAD $REF -- $DIR; then - echo "$GRN[Repo $name is unchanged!]$NORM" - else - echo "$CYN[Repo $name has changed:]$NORM" - git status | grep -v '(use' - read -p "Would you like to view the changes? [y/n]: " viewchange - case $viewchange in - y|yes|Y|Yes) git diff HEAD $REF -- $DIR ;; - esac - read -p "Would you like to push these changes? [y/n]: " pushchange - case $pushchange in - y|yes|Y|Yes) - while [ -z "$commitmsg" ]; do - read -p "Enter a commit message: " commitmsg - done - git add . && git commit -m "$commitmsg" && git push \ - && echo "$GRN[Changes to repo $name successfully pushed!]$NORM" \ - || echo "$RED[An error occured while pushing changes to repo $name!]$NORM" - commitmsg="" - ;; - esac - fi - else - echo "$BOLD$RED[Repo $name does not exist at $dir!]$NORM" - fi - done -} - -drdiff() { echo impl; } - -case $1 in - add) echo "add this in" ;; - *) rddiff ;; -esac diff --git a/.old/sync/pull b/.old/sync/pull deleted file mode 100755 index f52ec5e..0000000 --- a/.old/sync/pull +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -printusage() { echo "Usage: $0 [-b,--build] [<repo> ...] (repos: all,`echo $repos | tr ' ' ','`)" && exit; } - -repos=$repos"blr dmenu dotconfig scripts st timmywm" #repos=$repos"dotconfig|dwmpatches|scripts|st|timmywm" - -[ -z $1 ] || [ `echo "$@" | tr ' ' '\n' | grep -v -c '\-'` = 0 ] && printusage - -# Colors -BOLD="\033[1m" -NORM="\033[0m" -CYN="\033[0;36m" -RED="\033[0;31m" -GRN="\033[0;32m" -MAG="\033[0;35m" - -printsyncmsg() { echo "$CYN[Pulling repo '$arg'...]$NORM"; } -printsuccess() { echo "$BOLD$GRN[Successfully pulled repo '$arg']$NORM"; } -printerror() { echo "$BOLD$RED[Failed to pull repo '$arg']$NORM"; } - -#change colors -printmakemsg() { echo "$MAG[Building repo '$arg'...]$NORM"; } -printmakesuccess() { echo "$BOLD$GRN[Successfully built repo '$arg']$NORM"; } -printmakeerror() { echo "$BOLD$RED[Failed to build repo '$arg']$NORM"; } - -pullrepo() { - printsyncmsg - cd $1 && git pull --verbose \ - && printsuccess || printerror -} -makerepo() { - if echo "$opts" | grep '\-b'; then - printmakemsg - ${SUDO:-sudo} make clean install \ - && printmakesuccess || printmakeerror - fi -} -makeautoconf() { make autoconfig && echo "$BOLD$GRN[Automatically configured '$repo']$NORM"; } - -pullblr() { pullrepo ~/.local/src/programs/blr; } -pulldmenu() { pullrepo ~/.local/src/programs/dmenu && makeautoconf && makerepo; } -pulldotconfig() { pullrepo ~/.config; } -pullscripts() { pullrepo ~/.local/bin; } -pullst() { pullrepo ~/.local/src/programs/st && makeautoconf && makerepo; } -pulltimmywm() { pullrepo ~/.local/src/programs/timmywm && makeautoconf && makerepo; } - -for arg in "$@"; do - case $arg in - -b|--build) opts="$opts-b" ;; - all) $0 $opts $repos ;; - *) # Would like to use something like $repos) here but cant - for repo in $repos; do - [ "$arg" = "$repo" ] && pull$arg && break - done || printusage - ;; - esac -done diff --git a/.old/sync/pushsite b/.old/sync/pushsite deleted file mode 100755 index 1a1cbc3..0000000 --- a/.old/sync/pushsite +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -ssh root@tjkeller.xyz << EOF -cd /var/www/tjkeller/ -git pull -cd articles -git pull -./tssg -r tssgmd . template.html -EOF diff --git a/.old/sync/sink b/.old/sync/sink deleted file mode 100755 index b11b492..0000000 --- a/.old/sync/sink +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -printusage() { echo "Usage: $0 [<repos> ...] (repos: all,`echo $repos | tr ' ' ','`) [up|down]" && exit; } - -repos="docs patches" - -oper=`echo $@ | sed 's/.* //'` # Get last argument -([ -z $2 ] || ([ "$oper" != "up" ] && [ "$oper" != "down" ])) && printusage - -# rync options -#fix this too -ropts="--archive --partial --progress --recursive --update --verbose" # Equivalent to: -aPrvu --delete -rdest="rsync@tjkeller.xyz:" - -# Colors -BOLD="\033[1m" -NORM="\033[0m" -CYN="\033[0;36m" -RED="\033[0;31m" -GRN="\033[0;32m" - -printsyncmsg() { echo -n "$CYN[Syncing $SYNCNAME...]$NORM\n"; } -printsuccess() { echo -n "$BOLD$GRN[Successfully synced $SYNCNAME]\n"; } -printerror() { echo -n "$BOLD$RED[An error occured while syncing $SYNCNAME]\n"; } - -sync() { - [ $oper = "up" ] && SYNCNAME="$1$2 to $rdest$2" || SYNCNAME="$rdest$2 to $1$2" - printsyncmsg - (if [ $oper = "up" ]; then rsync $ropts $1$2 $rdest; else rsync $ropts --delete $rdest$2 $1; fi) \ - && printsuccess || printerror -} - -# arg1 = options + containing directory path, arg2 = file/directory name -syncdocs() { destdir="" && sync "/home/timmy/docs/" "school"; } -#syncsites() { destdir="" && sync "--exclude=pass /home/timmy/.local/src/" "sites"; } # Excludes password file -syncpatches() { destdir="" && sync "--exclude=.git /home/timmy/.local/src/programs/" "patches"; } # Excludes git files - -for arg in "$@"; do - case $arg in - all) $0 $repos $oper ;; - up|down) oper=$arg ;; - *) # Would like to use something like $repos) here but cant - for repo in $repos; do - [ "$arg" = "$repo" ] && sync$arg && break - done || printusage - ;; - esac -done diff --git a/.old/testtimmywm b/.old/testtimmywm deleted file mode 100755 index 33cda37..0000000 --- a/.old/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/.old/transtape b/.old/transtape deleted file mode 100755 index a0eaaee..0000000 --- a/.old/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/.old/umnt b/.old/umnt deleted file mode 100755 index 8191047..0000000 --- a/.old/umnt +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -exclude='\/efi$|\/boot$|\/home$|tbhdd$|\/$' -if mountedpartition=`lsblk --noheadings --paths --raw | awk "/part .+/ && !/$exclude/ "'{ print $1, "(on", $7 ")" }' | dmenu -p "Unmount Device... "` -then - doas umount -A "`echo $mountedpartition | sed 's/ .*//'`" \ - && notify-send --urgency low "Device Successfully Unmounted" "Partition \"$mountedpartition\" successfully unmounted" --time 120000 \ - || notify-send --urgency low "Error Unmounting Device" "Could not unmount partition \"$mountedpartition\"" -fi diff --git a/.old/vaapiencode b/.old/vaapiencode deleted file mode 100755 index ae079f2..0000000 --- a/.old/vaapiencode +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 \ - -ss 60 \ - -i "$1" \ - -t 60 \ - -c:v h264_vaapi \ - -b:v 1000k \ - -c:a libopus -b:a 128k \ - "h264_$1.mkv" diff --git a/.old/viewintensitypro b/.old/viewintensitypro deleted file mode 100755 index cd2d73d..0000000 --- a/.old/viewintensitypro +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -#for mod in blackmagic blackmagic-io; do doas modprobe $mod; done -#doas rc-service DesktopVideoHelper start - -ffplay \ --f decklink -format_code ntsc -i "Intensity Pro" \ --vf yadif diff --git a/.old/viewwebcam b/.old/viewwebcam deleted file mode 100755 index c56d879..0000000 --- a/.old/viewwebcam +++ /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/.old/virt b/.old/virt deleted file mode 100755 index 6d9f252..0000000 --- a/.old/virt +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -virtdir=~/.local/share/virt - -halfram() { awk '/^MemTotal/ { printf "%dM\n", $2/2/1024 }' /proc/meminfo; } # Needs to be either in M or G according to man page -halfthreads() { echo $(( $(nproc) / 2 )); } -startvm() { - qemu-system-x86_64 \ - -enable-kvm \ - -cpu host \ - -m $(halfram) \ - -smp $(halfthreads) \ - -net nic \ - -display sdl,gl=on \ - -audiodev pa,id=pa1,server=/run/user/1000/pulse/native \ - -soundhw all \ - -boot menu=on \ - -drive file="$virtdir/$1.img" \ - -drive file=~/docs/oss/openbsd7.0.img \ -; } - #-vga none \ - #-nographic \ - -vms="$(ls $virtdir)" - -[ -n "$1" ] && vm="$1" || vm=$(echo "$vms" | sed 's/\.img//' | dmenu -p "Choose Virtual Machine Image or Enter Name for New Virtual Machine") - -if echo "$vms" | grep "^$vm.img$" >/dev/null; then - startvm "$vm" -else - qemu-img create -f qcow2 "$virtdir/$vm.img" $(echo -n "4G\n8G\n16G\n32G" | dmenu -p "Choose Size of Virtual Machine \"$vm\"") -fi diff --git a/.old/volcon b/.old/volcon deleted file mode 100755 index 9940c67..0000000 --- a/.old/volcon +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -amixer -D pipewire sset Master $1 > /dev/null -dwmsbup 10 diff --git a/.old/volume b/.old/volume deleted file mode 100755 index 4a4b4a8..0000000 --- a/.old/volume +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/awk -f - -BEGIN { -cmd="amixer -D pipewire sget Master" -FS="[][]" -while (cmd | getline) { - if (NF > 1) { - vol=int($2) - if ($4 == "off") - icon="" - else if (vol > 70) - icon="" - else if (vol > 40) - icon="" - else if (vol > 10) - icon="" - else - icon="" - #printf "%s %s | %05.2fdB", icon, $2, $4 - print icon" "$2 - } -} -} - -##!/bin/sh -##amixer sget Master | awk -F'[][]' '/%/{print $2" | "$4 " [" $6 "]"}' -#amixer -M sget Master | sed -n 's/.*Playback [0-9]* \[//; s/. ./ | /; s/\] .off\]/ \[mute\]/p; s/\] .on.//p' diff --git a/.old/wgconnect b/.old/wgconnect deleted file mode 100755 index de8f307..0000000 --- a/.old/wgconnect +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# Connect to/disconnect from wireguard tunnel using dmenu - -sudo="${SUDO:-sudo}" -pass="$(xsudo --get-pass)" - -ssudo() { echo "$pass" | $sudo $@ ; } - -dmenu_confirm_continue() { - case "$(echo "yes\nno" | dmenu -p "$1")" in - yes) - ;; - *) exit 0 ;; - esac -} - -curtun="$(ssudo wg show | sed 's/interface: //;q')" - -# Ask to disconnect from current interface -if [ -n "$curtun" ]; then - dmenu_confirm_continue "Currently connected to tunnel $curtun. Disconnect?" - - output="$(ssudo wg-quick down "$curtun" 2>&1)" - notify-send "Disconnected from $curtun" "$output" - - dmenu_confirm_continue "Connect to another interface?" -fi - -# Connect to new interface -tundir=/etc/wireguard - -tun="$tundir/$(ssudo ls "$tundir" | grep "\.conf$" | dmenu -p "Connect to which tunnel?")" - -if ! ssudo cat $tun >/dev/null 2>/dev/null; then - notify-send "Couldn't connect to tunnel $tun" - exit 1 -fi - -output="$(ssudo wg-quick up "$tun" 2>&1)" -notify-send "Connected to $tun" "$output" diff --git a/.old/win10 b/.old/win10 deleted file mode 100755 index 130df5c..0000000 --- a/.old/win10 +++ /dev/null @@ -1,4 +0,0 @@ -#!/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 deleted file mode 100755 index f7b4a47..0000000 --- a/.old/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 |