summaryrefslogtreecommitdiff
path: root/old
diff options
context:
space:
mode:
Diffstat (limited to 'old')
-rwxr-xr-xold/bsdtpscroll4
-rwxr-xr-xold/ffconcat12
-rwxr-xr-xold/hwtexedit49
-rwxr-xr-xold/lipsum.~1~90
-rwxr-xr-xold/rectape13
-rwxr-xr-xold/rectapevaapi12
-rwxr-xr-xold/settitle4
-rwxr-xr-xold/setup76
-rwxr-xr-xold/speedtest8
-rwxr-xr-xold/speedtest-cli8
-rwxr-xr-xold/testtimmywm5
-rwxr-xr-xold/transtape11
-rwxr-xr-xold/viewintensitypro4
-rwxr-xr-xold/webcamdesktopffplay2
-rwxr-xr-xold/win104
-rwxr-xr-xold/ytdl-dlplst5
16 files changed, 307 insertions, 0 deletions
diff --git a/old/bsdtpscroll b/old/bsdtpscroll
new file mode 100755
index 0000000..0f2cd20
--- /dev/null
+++ b/old/bsdtpscroll
@@ -0,0 +1,4 @@
+#!/bin/sh
+xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation" 1
+xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Button" 2
+xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Axes" 6 7 4 5
diff --git a/old/ffconcat b/old/ffconcat
new file mode 100755
index 0000000..06eb066
--- /dev/null
+++ b/old/ffconcat
@@ -0,0 +1,12 @@
+#!/bin/sh
+ffconcat="$(ls | sed "s/^/file '/; s/$/'/")"
+echo "$ffconcat" > ffconcat
+
+ffmpeg \
+ -f concat \
+ -safe 0 \
+ -i ffconcat \
+ -c copy \
+ out.mkv
+
+rm ffconcat
diff --git a/old/hwtexedit b/old/hwtexedit
new file mode 100755
index 0000000..262d10b
--- /dev/null
+++ b/old/hwtexedit
@@ -0,0 +1,49 @@
+#!/bin/sh
+dir=~/docs/school
+
+files="$(find $dir -name \*.tex -printf "%T@ %p\n" | sort -nr | cut -d' ' -f 2-)"
+
+echo "$files" | awk '
+function printcol(c1, c2, c3) { printf "%-12s %-32s %s\n", c1, c2, c3 }
+BEGIN {
+ printcol(" class:", "containing dir:", "file:")
+ fn = 1
+}
+{
+ tf = c = cf = $0
+ sub(/.*\//, "", tf)
+ sub("'$dir'/", "", c)
+ sub(/\/.*/, "", c)
+ sub("'$dir'/"c"/", "", cf)
+ sub("/"tf, "", cf)
+ printcol(fn": "c, cf, tf)
+ fn++
+}
+'
+read -p "Choose file number: " filenum
+file="$(echo "$files" | head -$filenum | tail -1)"
+dir="$(echo "$file" | sed 's/\(\/.*\)\/.*/\1/')"
+
+cd "$dir"
+
+st -e $EDITOR "$file" &
+echo "$file" | entr pdflatex -output-directory "$dir" "$file" || echo "entr or LaTeX is not installed!" &
+zathura "$(echo "$file" | sed 's/.tex$/.pdf/')" &
+
+#listfiles() {
+# pids=$(xdotool search --class "Vim")
+# for pid in $pids; do
+# names="$(xdotool getwindowname $pid | grep '\.tex')\n$names"
+# #$openfiles="$(echo "$name" | cut -d' ' -f1)\n$openfiles"
+# #$openfilepaths="$(echo "$name" | awk -F'[()]' '{ print $2 }')\n$openfiles"
+# done
+# #file="$(echo $openfiles | grep "^$1")"
+# [ -z "$file" ] \
+# && interactiveopt "$(echo $openfiles | sort -bu | tail +2)" "Which file to autocompile? " 1 \
+# && file="$opt"
+#}
+#
+#[ -e "$1" ] && file="$1" || listfiles
+#
+#echo "$file" | entr pdflatex "$file" || echo "entr or LaTeX is not installed!"
+
diff --git a/old/lipsum.~1~ b/old/lipsum.~1~
new file mode 100755
index 0000000..efa71b5
--- /dev/null
+++ b/old/lipsum.~1~
@@ -0,0 +1,90 @@
+#!/usr/bin/awk -f
+
+function printusage() {
+ print "Usage: lipsum [# of] [w/words|s/sentences|p/paragraphs] [1/t/true|0/f/false output 'lorem ipsum' in first entry] [min words] [max words]\n"
+ exit 1
+}
+
+function capitalize(word) {
+ sub(/./, toupper(substr(word, 0, 1)), word)
+ print word
+}
+
+function isint(arg) {
+ return arg ~ /^[0-9]+$/
+}
+
+function randrange(min, max) {
+ return int((rand() * (max - min)) + min)
+}
+
+function genword() {
+ wc++ # There's gotta be a more efficient way of doing this
+ return (wc > 5 || !litextout) ? word[randrange(0, dictlen)] : litext[wc - 1]
+}
+
+function genwords(words) {
+ if (words > 0) {
+ capitalize(genword())
+ for (i = 1; i < words; i++)
+ print " " genword()
+ print "\n"
+ }
+}
+
+function gensentences(sentences, delim, min, max) {
+ for (; sentences > 0; sentences--) {
+ capitalize(genword())
+ words = randrange(min, max) # Isn't possible to initialize or increment multiple variables in awk for loops
+ for (i = 1; i < words; i++)
+ print (rand() < 0.10 ? ", " : " ") genword()
+ print delim
+ }
+}
+
+function genparagraphs(paragraphs, min, max) {
+ for (; paragraphs > 0; paragraphs--) {
+ print "\t"
+ gensentences(randrange(6, 10), ". ", min, max)
+ print "\n"
+ }
+}
+
+BEGIN {
+ dictionary = "/home/timmy/.local/share/lorem-ipsum-dictionary" # List of lorem ipsum words separated by newlines
+ litext[0] = "lorem"; litext[1] = "ipsum"; litext[2] = "dolor"; litext[3] = "sit"; litext[4] = "amet"
+
+ ORS = ""
+ srand()
+
+ for (dictlen = 0; getline < dictionary; dictlen++)
+ word[dictlen] = $0
+
+ # Parse Arguments
+ !isint(ARGV[1]) && ARGV[1] && printusage()
+ numof = ARGC > 1 ? ARGV[1] : 5
+ mode = ARGC > 2 ? ARGV[2] : "p"
+ litextout = 1
+ if (ARGV[3])
+ switch (ARGV[3]) {
+ case /^1$|^t$|^true$/: litextout = 1; break
+ case /^0$|^f$|^false$/: litextout = 0; break
+ default: printusage()
+ }
+ min = isint(ARGV[4]) ? ARGV[4] : 5
+ max = isint(ARGV[5]) ? ARGV[5] : 12
+
+ switch (mode) {
+ case /^w$|^words$/:
+ genwords(numof)
+ break
+ case /^s$|^sentences$/:
+ gensentences(numof, ".\n", min, max)
+ break
+ case /^p$|^paragraphs$/:
+ genparagraphs(numof, min, max)
+ break
+ default:
+ printusage()
+ }
+}
diff --git a/old/rectape b/old/rectape
new file mode 100755
index 0000000..1e54370
--- /dev/null
+++ b/old/rectape
@@ -0,0 +1,13 @@
+#!/bin/sh
+if [ -z "$1" ]; then
+ $1=untitled_$(ls | wc -l)
+fi
+
+ffmpeg \
+-f decklink -format_code ntsc -i "Intensity Pro" \
+-c:v libx264 \
+-qmin 6 -qmax 26 -qdiff 4 \
+-vf yadif \
+-c:a aac -b:a 384k \
+-metadata "title"="$1" \
+"$1.mkv"
diff --git a/old/rectapevaapi b/old/rectapevaapi
new file mode 100755
index 0000000..16bd190
--- /dev/null
+++ b/old/rectapevaapi
@@ -0,0 +1,12 @@
+#!/bin/sh
+if [ -z "$1" ]; then
+ title="untitled_$(ls | wc -l)"
+fi
+
+ffmpeg -hwaccel auto -vaapi_device /dev/dri/renderD128 \
+-f decklink -format_code ntsc -i "Intensity Pro" \
+-c:v hevc_vaapi \
+-vf "yadif,format=nv12,hwupload" \
+-c:a libopus -b:a 384k \
+-metadata "title"="$1$title" \
+"$1$title.mkv"
diff --git a/old/settitle b/old/settitle
new file mode 100755
index 0000000..7cdd7d1
--- /dev/null
+++ b/old/settitle
@@ -0,0 +1,4 @@
+#!/bin/sh
+xdotool set_window --class "$2" $(xdotool search --pid $1) # command chaining doesnt work for some reason
+#xdotool getactivewindow set_window --class "$1"
+#[ -z "$2" ] && echo -n "\e]0;$2\a"
diff --git a/old/setup b/old/setup
new file mode 100755
index 0000000..eaeec39
--- /dev/null
+++ b/old/setup
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+#interactiveopt() {
+# # Usage: interactiveopt "options" "prompt"
+# echo "$1" | nl -s': ' 1>&2
+# # Parse user input
+# read -p "$2" choices 1>&2 \
+# && choices="$(echo $choices | cut -d' ' -f1-)"
+# for choice in $choices; do
+# case "$choice" in
+# [0-9]*) opt="$opt $(echo "$1" | head -"$(echo $choice | tr -cd '[:digit:]')" | tail -1)";;
+# *) echo "Invalid option \"$opt\"" 1>&2 ;;
+# esac
+# done
+# echo "$opt"
+#}
+
+# Open as root in pcmanfm
+pcmanfmconf() {
+ pcmanfmroot=~/.local/share/file-manager/actions
+ mkdir -p $pcmanfmroot
+ echo " [Desktop Entry]
+Type=Action
+Tooltip=Open Folder As Root
+Name=Open Folder As Root
+Profiles=profile-zero;
+Icon=gtk-dialog-authentication
+
+[X-Action-Profile profile-zero]
+MimeTypes=inode/directory;
+Exec=/home/timmy/.local/bin/x11/xsudo /usr/bin/pcmanfm %u
+Name=Default profile" > $pcmanfmroot/root.desktop
+}
+
+minticons() {
+ gitdir="/tmp/mint-y-icons"
+ iconsdir="$gitdir/usr/share/icons"
+ git clone https://github.com/linuxmint/mint-y-icons.git "$gitdir"
+ #iconsets="$(interactiveopt "$(ls "$iconsdir")" "Choose icon sets (if using dark theme, COPY THE NON-DARK THEME TOO): ")"
+ #iconsets="$iconset Mint-Y"
+ #for iconset in $iconsets; do
+ # mv "$iconsdir/$iconset" $iconsdestdir
+ #done
+ mv $iconsdir/* $iconsdestdir
+ gtk-update-icon-cache
+}
+
+mintthemes() {
+ gitdir="/tmp/mint-themes"
+ themesdir="$gitdir/usr/share/themes"
+ #iconsdir="$gitdir/usr/share/icons"
+ git clone https://github.com/linuxmint/mint-themes.git "$gitdir"
+ curdir="$(pwd)"
+ cd $gitdir
+ make
+ #themes="$(interactiveopt "$(ls "$themesdir")" "Choose themes: ")"
+ ##iconset="$iconset Mint-Y"
+ #for theme in $themes; do
+ # mv "$themesdir/$theme" $themesdestdir
+ #done
+ #iconsets="$(interactiveopt "$(ls "$iconsdir")" "Choose icon set (if using dark theme, COPY THE NON-DARK THEME TOO): ")"
+ #iconset="$iconset Mint-Y"
+ #for iconset in $iconsets; do
+ # mv "$iconsdir/$iconset" $iconsdestdir
+ #done
+ #gtk-update-icon-cache
+ mv $themesdir/* $themesdestdir
+}
+
+iconsdestdir=/usr/share/icons
+themesdestdir=/usr/share/themes
+mkdir -p $iconsdestdir $themesdestdir
+
+pcmanfmconf
+minticons
+mintthemes
diff --git a/old/speedtest b/old/speedtest
new file mode 100755
index 0000000..913f9ef
--- /dev/null
+++ b/old/speedtest
@@ -0,0 +1,8 @@
+#!/usr/bin/python3.9
+# -*- coding: utf-8 -*-
+import re
+import sys
+from speedtest import main
+if __name__ == '__main__':
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+ sys.exit(main())
diff --git a/old/speedtest-cli b/old/speedtest-cli
new file mode 100755
index 0000000..913f9ef
--- /dev/null
+++ b/old/speedtest-cli
@@ -0,0 +1,8 @@
+#!/usr/bin/python3.9
+# -*- coding: utf-8 -*-
+import re
+import sys
+from speedtest import main
+if __name__ == '__main__':
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+ sys.exit(main())
diff --git a/old/testtimmywm b/old/testtimmywm
new file mode 100755
index 0000000..33cda37
--- /dev/null
+++ b/old/testtimmywm
@@ -0,0 +1,5 @@
+#!/bin/sh
+Xephyr -br -ac -reset -screen 2160x1440 :1 &
+sleep 1
+export DISPLAY=:1
+timmywm &
diff --git a/old/transtape b/old/transtape
new file mode 100755
index 0000000..a0eaaee
--- /dev/null
+++ b/old/transtape
@@ -0,0 +1,11 @@
+#!/bin/sh
+if [ -z "$1" ]; then
+ exit
+fi
+
+ffmpeg -hwaccel auto -vaapi_device /dev/dri/renderD128 \
+-i "$1" \
+-c:v hevc_vaapi \
+-vf "yadif,format=nv12,hwupload" \
+-metadata "title"="$1" \
+"$1as.mkv"
diff --git a/old/viewintensitypro b/old/viewintensitypro
new file mode 100755
index 0000000..1b1f77c
--- /dev/null
+++ b/old/viewintensitypro
@@ -0,0 +1,4 @@
+#!/bin/sh
+ffplay \
+-f decklink -format_code ntsc -i "Intensity Pro" \
+-vf yadif
diff --git a/old/webcamdesktopffplay b/old/webcamdesktopffplay
new file mode 100755
index 0000000..c56d879
--- /dev/null
+++ b/old/webcamdesktopffplay
@@ -0,0 +1,2 @@
+#!/bin/sh
+ffplay -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 30 -i /dev/video0
diff --git a/old/win10 b/old/win10
new file mode 100755
index 0000000..130df5c
--- /dev/null
+++ b/old/win10
@@ -0,0 +1,4 @@
+#!/bin/sh
+doas chown -R timmy:timmy /dev/shm
+virsh start win10-clone
+looking-glass-client -F
diff --git a/old/ytdl-dlplst b/old/ytdl-dlplst
new file mode 100755
index 0000000..f7b4a47
--- /dev/null
+++ b/old/ytdl-dlplst
@@ -0,0 +1,5 @@
+#!/bin/sh
+echo "Getting Video ID's..."
+for id in $(youtube-dl --get-id "$1"); do
+ youtube-dl --newline "https://youtu.be/$id" &
+done