From 35a2dd3734f1d31060fe28837cf0e1d947c8d6f4 Mon Sep 17 00:00:00 2001 From: Timmy Keller Date: Sun, 17 Apr 2022 10:46:59 -0500 Subject: reorganize all scripts --- .old/bsdtpscroll | 4 +++ .old/delsimpic | 39 +++++++++++++++++++++ .old/ffconcat | 12 +++++++ .old/hwtexedit | 49 ++++++++++++++++++++++++++ .old/lipsum | 87 ++++++++++++++++++++++++++++++++++++++++++++++ .old/lipsum.~1~ | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ .old/lipsumsh | 72 ++++++++++++++++++++++++++++++++++++++ .old/memuse | 33 ++++++++++++++++++ .old/mnt | 11 ++++++ .old/netstat | 45 ++++++++++++++++++++++++ .old/sb-internet | 24 +++++++++++++ .old/settitle | 4 +++ .old/setup | 76 ++++++++++++++++++++++++++++++++++++++++ .old/setwindowtitle | 10 ++++++ .old/shblr | 14 ++++++++ .old/sinkold | 48 ++++++++++++++++++++++++++ .old/speedtest | 8 +++++ .old/speedtest-cli | 8 +++++ .old/testtimmywm | 5 +++ .old/transtape | 11 ++++++ .old/umnt | 8 +++++ .old/virt | 31 +++++++++++++++++ .old/webcamdesktopffplay | 2 ++ .old/win10 | 4 +++ .old/ytdl-dlplst | 5 +++ bar/wmip | 2 +- keyboard/dmenuunicode | 18 ---------- keyboard/emojiselector | 5 +++ launch/shows | 2 +- misc/screenrec | 1 - misc/screenshot | 1 - misc/wmip | 1 - old/bsdtpscroll | 4 --- old/delsimpic | 39 --------------------- old/ffconcat | 12 ------- old/hwtexedit | 49 -------------------------- old/lipsum | 87 ---------------------------------------------- old/lipsum.~1~ | 90 ------------------------------------------------ old/lipsumsh | 72 -------------------------------------- old/memuse | 33 ------------------ old/mnt | 11 ------ old/netstat | 45 ------------------------ old/rectape | 13 ------- old/rectapevaapi | 12 ------- old/sb-internet | 24 ------------- old/settitle | 4 --- old/setup | 76 ---------------------------------------- old/setwindowtitle | 10 ------ old/shblr | 14 -------- old/sinkold | 48 -------------------------- old/speedtest | 8 ----- old/speedtest-cli | 8 ----- old/testtimmywm | 5 --- old/transtape | 11 ------ old/umnt | 8 ----- old/viewintensitypro | 4 --- old/virt | 31 ----------------- old/webcamdesktopffplay | 2 -- old/win10 | 4 --- old/ytdl-dlplst | 5 --- video/rectape | 16 +++++++++ video/rectapevaapi | 13 +++++++ video/viewintensitypro | 7 ++++ 63 files changed, 743 insertions(+), 752 deletions(-) create mode 100755 .old/bsdtpscroll create mode 100755 .old/delsimpic create mode 100755 .old/ffconcat create mode 100755 .old/hwtexedit create mode 100755 .old/lipsum create mode 100755 .old/lipsum.~1~ create mode 100755 .old/lipsumsh create mode 100755 .old/memuse create mode 100755 .old/mnt create mode 100755 .old/netstat create mode 100755 .old/sb-internet create mode 100755 .old/settitle create mode 100755 .old/setup create mode 100755 .old/setwindowtitle create mode 100755 .old/shblr create mode 100755 .old/sinkold 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/umnt create mode 100755 .old/virt create mode 100755 .old/webcamdesktopffplay create mode 100755 .old/win10 create mode 100755 .old/ytdl-dlplst delete mode 100755 keyboard/dmenuunicode create mode 100755 keyboard/emojiselector delete mode 120000 misc/screenrec delete mode 120000 misc/screenshot delete mode 120000 misc/wmip delete mode 100755 old/bsdtpscroll delete mode 100755 old/delsimpic delete mode 100755 old/ffconcat delete mode 100755 old/hwtexedit delete mode 100755 old/lipsum delete mode 100755 old/lipsum.~1~ delete mode 100755 old/lipsumsh delete mode 100755 old/memuse delete mode 100755 old/mnt delete mode 100755 old/netstat delete mode 100755 old/rectape delete mode 100755 old/rectapevaapi delete mode 100755 old/sb-internet delete mode 100755 old/settitle delete mode 100755 old/setup delete mode 100755 old/setwindowtitle delete mode 100755 old/shblr delete mode 100755 old/sinkold delete mode 100755 old/speedtest delete mode 100755 old/speedtest-cli delete mode 100755 old/testtimmywm delete mode 100755 old/transtape delete mode 100755 old/umnt delete mode 100755 old/viewintensitypro delete mode 100755 old/virt delete mode 100755 old/webcamdesktopffplay delete mode 100755 old/win10 delete mode 100755 old/ytdl-dlplst create mode 100755 video/rectape create mode 100755 video/rectapevaapi create mode 100755 video/viewintensitypro 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/delsimpic b/.old/delsimpic new file mode 100755 index 0000000..83c3d1a --- /dev/null +++ b/.old/delsimpic @@ -0,0 +1,39 @@ +#!/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/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 b/.old/lipsum new file mode 100755 index 0000000..7ae9b7e --- /dev/null +++ b/.old/lipsum @@ -0,0 +1,87 @@ +#!/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~ 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/lipsumsh b/.old/lipsumsh new file mode 100755 index 0000000..d229877 --- /dev/null +++ b/.old/lipsumsh @@ -0,0 +1,72 @@ +#!/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 new file mode 100755 index 0000000..eb9ffde --- /dev/null +++ b/.old/memuse @@ -0,0 +1,33 @@ +#!/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/mnt b/.old/mnt new file mode 100755 index 0000000..7547912 --- /dev/null +++ b/.old/mnt @@ -0,0 +1,11 @@ +#!/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/netstat b/.old/netstat new file mode 100755 index 0000000..e7b23c3 --- /dev/null +++ b/.old/netstat @@ -0,0 +1,45 @@ +#!/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/sb-internet b/.old/sb-internet new file mode 100755 index 0000000..ee1a160 --- /dev/null +++ b/.old/sb-internet @@ -0,0 +1,24 @@ +#!/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/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/setwindowtitle b/.old/setwindowtitle new file mode 100755 index 0000000..a2b9218 --- /dev/null +++ b/.old/setwindowtitle @@ -0,0 +1,10 @@ +#!/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 new file mode 100755 index 0000000..4570afc --- /dev/null +++ b/.old/shblr @@ -0,0 +1,14 @@ +#!/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/sinkold b/.old/sinkold new file mode 100755 index 0000000..3022963 --- /dev/null +++ b/.old/sinkold @@ -0,0 +1,48 @@ +#!/bin/sh + +printusage() { echo "Usage: $0 [ ...] (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/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/umnt b/.old/umnt new file mode 100755 index 0000000..8191047 --- /dev/null +++ b/.old/umnt @@ -0,0 +1,8 @@ +#!/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/virt b/.old/virt new file mode 100755 index 0000000..6d9f252 --- /dev/null +++ b/.old/virt @@ -0,0 +1,31 @@ +#!/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/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/bar/wmip b/bar/wmip index 3105038..56fe23d 100755 --- a/bar/wmip +++ b/bar/wmip @@ -1,2 +1,2 @@ #!/bin/sh -ip a | awk '!/ lo/ && /inet / { sub(/\/.*/, "", $2); print $2 }' +ip a | awk '!/ (lo|dummy|virbr)/ && /inet / { sub(/\/.*/, "", $2); printf "%-12s %s\n", $NF":", $2 }' diff --git a/keyboard/dmenuunicode b/keyboard/dmenuunicode deleted file mode 100755 index 066099a..0000000 --- a/keyboard/dmenuunicode +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# The famous "get a menu of emojis to copy" script. - -# Get user selection via dmenu from emoji file. -chosen=$(cut -d ';' -f1 ~/.local/share/emojis | dmenu -l 30 | sed "s/ .*//") - -# Exit if none chosen. -[ -z "$chosen" ] && exit - -# If you run this command with an argument, it will automatically insert the -# character. Otherwise, show a message that the emoji has been copied. -if [ -n "$1" ]; then - xdotool type "$chosen" -else - echo "$chosen" | tr -d '\n' | xclip -selection clipboard - notify-send -u low "'$chosen' copied to clipboard." & -fi diff --git a/keyboard/emojiselector b/keyboard/emojiselector new file mode 100755 index 0000000..a47d348 --- /dev/null +++ b/keyboard/emojiselector @@ -0,0 +1,5 @@ +#!/bin/sh +emojis=~/.local/share/emojis +chosen=$(grep -v '^$\|#' "$emojis" | dmenu -l 30 | cut -d' ' -f1) + +[ -z "$chosen" ] || xdotool type "$chosen" diff --git a/launch/shows b/launch/shows index 2d964a7..a0cb8a6 100755 --- a/launch/shows +++ b/launch/shows @@ -18,7 +18,7 @@ case "$season" in 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 | sort -R | head -1)" ;; + $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" diff --git a/misc/screenrec b/misc/screenrec deleted file mode 120000 index cecd2f8..0000000 --- a/misc/screenrec +++ /dev/null @@ -1 +0,0 @@ -../video/screenrec \ No newline at end of file diff --git a/misc/screenshot b/misc/screenshot deleted file mode 120000 index 3eb7217..0000000 --- a/misc/screenshot +++ /dev/null @@ -1 +0,0 @@ -/home/timmy/.local/bin/keyboard/screenshot \ No newline at end of file diff --git a/misc/wmip b/misc/wmip deleted file mode 120000 index 44c49c2..0000000 --- a/misc/wmip +++ /dev/null @@ -1 +0,0 @@ -../bar/wmip \ No newline at end of file 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/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/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/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/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 1e54370..0000000 --- a/old/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/old/rectapevaapi b/old/rectapevaapi deleted file mode 100755 index 16bd190..0000000 --- a/old/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/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/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 eaeec39..0000000 --- a/old/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/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/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: 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/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/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/viewintensitypro b/old/viewintensitypro deleted file mode 100755 index 1b1f77c..0000000 --- a/old/viewintensitypro +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -ffplay \ --f decklink -format_code ntsc -i "Intensity Pro" \ --vf yadif 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/webcamdesktopffplay b/old/webcamdesktopffplay deleted file mode 100755 index c56d879..0000000 --- a/old/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/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 diff --git a/video/rectape b/video/rectape new file mode 100755 index 0000000..fa631eb --- /dev/null +++ b/video/rectape @@ -0,0 +1,16 @@ +#!/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/video/rectapevaapi b/video/rectapevaapi new file mode 100755 index 0000000..4ddf868 --- /dev/null +++ b/video/rectapevaapi @@ -0,0 +1,13 @@ +#!/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/video/viewintensitypro b/video/viewintensitypro new file mode 100755 index 0000000..cd2d73d --- /dev/null +++ b/video/viewintensitypro @@ -0,0 +1,7 @@ +#!/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 -- cgit v1.2.3