From 2140ab51deed88e90eafebf9520fa5f9995dc7c9 Mon Sep 17 00:00:00 2001 From: twells46 <173561638+twells46@users.noreply.github.com> Date: Wed, 31 Dec 2025 13:28:05 -0600 Subject: Migrate from stow --- private_dot_local/bin/executable_cbv | 9 ++ private_dot_local/bin/executable_cbv-volume | 4 + private_dot_local/bin/executable_cheat | 3 + private_dot_local/bin/executable_check_mullvad | 3 + .../bin/executable_cleanup_filenames.zsh | 7 ++ private_dot_local/bin/executable_clipboard.sh | 7 ++ private_dot_local/bin/executable_clipboard_put.sh | 7 ++ private_dot_local/bin/executable_compiler | 50 +++++++++++ private_dot_local/bin/executable_compresspdf | 8 ++ private_dot_local/bin/executable_css-httpd.sh | 15 ++++ private_dot_local/bin/executable_get-bookmark | 7 ++ private_dot_local/bin/executable_gopassmenu | 15 ++++ private_dot_local/bin/executable_gousermenu | 11 +++ private_dot_local/bin/executable_linkmenu | 96 ++++++++++++++++++++++ .../bin/executable_mullvad-browser-launcher | 3 + private_dot_local/bin/executable_p9start | 5 ++ .../bin/executable_packages-list-arch.zsh | 3 + private_dot_local/bin/executable_passmenu | 35 ++++++++ private_dot_local/bin/executable_remaps | 7 ++ private_dot_local/bin/executable_rename-fat32 | 34 ++++++++ private_dot_local/bin/executable_rippy | 35 ++++++++ private_dot_local/bin/executable_rmdc | 3 + private_dot_local/bin/executable_save-bookmark | 15 ++++ private_dot_local/bin/executable_shst | 6 ++ private_dot_local/bin/executable_simenv | 2 + private_dot_local/bin/executable_status.sh | 22 +++++ private_dot_local/bin/executable_surf-get-url | 3 + private_dot_local/bin/executable_timer | 17 ++++ private_dot_local/bin/executable_vid2opus | 11 +++ private_dot_local/bin/executable_vpn | 31 +++++++ private_dot_local/bin/executable_wl-get-bm | 3 + private_dot_local/bin/executable_workout.sh | 7 ++ private_dot_local/bin/executable_wsct | 5 ++ private_dot_local/bin/executable_yt-conv | 8 ++ private_dot_local/bin/executable_zip2gzip | 9 ++ 35 files changed, 506 insertions(+) create mode 100644 private_dot_local/bin/executable_cbv create mode 100644 private_dot_local/bin/executable_cbv-volume create mode 100644 private_dot_local/bin/executable_cheat create mode 100644 private_dot_local/bin/executable_check_mullvad create mode 100644 private_dot_local/bin/executable_cleanup_filenames.zsh create mode 100644 private_dot_local/bin/executable_clipboard.sh create mode 100644 private_dot_local/bin/executable_clipboard_put.sh create mode 100644 private_dot_local/bin/executable_compiler create mode 100644 private_dot_local/bin/executable_compresspdf create mode 100644 private_dot_local/bin/executable_css-httpd.sh create mode 100644 private_dot_local/bin/executable_get-bookmark create mode 100644 private_dot_local/bin/executable_gopassmenu create mode 100644 private_dot_local/bin/executable_gousermenu create mode 100644 private_dot_local/bin/executable_linkmenu create mode 100644 private_dot_local/bin/executable_mullvad-browser-launcher create mode 100644 private_dot_local/bin/executable_p9start create mode 100644 private_dot_local/bin/executable_packages-list-arch.zsh create mode 100644 private_dot_local/bin/executable_passmenu create mode 100644 private_dot_local/bin/executable_remaps create mode 100644 private_dot_local/bin/executable_rename-fat32 create mode 100644 private_dot_local/bin/executable_rippy create mode 100644 private_dot_local/bin/executable_rmdc create mode 100644 private_dot_local/bin/executable_save-bookmark create mode 100644 private_dot_local/bin/executable_shst create mode 100644 private_dot_local/bin/executable_simenv create mode 100644 private_dot_local/bin/executable_status.sh create mode 100644 private_dot_local/bin/executable_surf-get-url create mode 100644 private_dot_local/bin/executable_timer create mode 100644 private_dot_local/bin/executable_vid2opus create mode 100644 private_dot_local/bin/executable_vpn create mode 100644 private_dot_local/bin/executable_wl-get-bm create mode 100644 private_dot_local/bin/executable_workout.sh create mode 100644 private_dot_local/bin/executable_wsct create mode 100644 private_dot_local/bin/executable_yt-conv create mode 100644 private_dot_local/bin/executable_zip2gzip (limited to 'private_dot_local/bin') diff --git a/private_dot_local/bin/executable_cbv b/private_dot_local/bin/executable_cbv new file mode 100644 index 0000000..622c01e --- /dev/null +++ b/private_dot_local/bin/executable_cbv @@ -0,0 +1,9 @@ +#!/bin/sh + +tmpdir="$(mktemp -d)" +trap 'rm -rf $tmpdir' EXIT +echo "$1" +unzip "$1" -d "$tmpdir" +#tar -xf "$1" --directory="$tmpdir" +#nsxiv -f "$tmpdir"/* +imv-wayland "$tmpdir"/* diff --git a/private_dot_local/bin/executable_cbv-volume b/private_dot_local/bin/executable_cbv-volume new file mode 100644 index 0000000..350e28d --- /dev/null +++ b/private_dot_local/bin/executable_cbv-volume @@ -0,0 +1,4 @@ +#!/bin/sh + +for i in "$1"/*; do cbv "$i"; done + diff --git a/private_dot_local/bin/executable_cheat b/private_dot_local/bin/executable_cheat new file mode 100644 index 0000000..da479fb --- /dev/null +++ b/private_dot_local/bin/executable_cheat @@ -0,0 +1,3 @@ +#!/bin/sh + +curl "https://cht.sh/$1" diff --git a/private_dot_local/bin/executable_check_mullvad b/private_dot_local/bin/executable_check_mullvad new file mode 100644 index 0000000..19a73e3 --- /dev/null +++ b/private_dot_local/bin/executable_check_mullvad @@ -0,0 +1,3 @@ +#!/bin/sh + +curl https://am.i.mullvad.net/connected diff --git a/private_dot_local/bin/executable_cleanup_filenames.zsh b/private_dot_local/bin/executable_cleanup_filenames.zsh new file mode 100644 index 0000000..dc41f84 --- /dev/null +++ b/private_dot_local/bin/executable_cleanup_filenames.zsh @@ -0,0 +1,7 @@ +#!/bin/zsh +# Rmove annoying characters from filenames +# You may need to run multiple times to get everything depending on directory names + +for f in **/*\ *; do mv "${f}" "${f// /_}"; done +for f in **/*\'*; do mv "$f" "${f//'/}"; done +for f in **/*"*; do mv "$f" "${f//"/}"; done diff --git a/private_dot_local/bin/executable_clipboard.sh b/private_dot_local/bin/executable_clipboard.sh new file mode 100644 index 0000000..4c426b6 --- /dev/null +++ b/private_dot_local/bin/executable_clipboard.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ "${XDG_SESSION_TYPE}" = "wayland" ]; then + cat | wl-copy +else + cat | xsel -ib +fi diff --git a/private_dot_local/bin/executable_clipboard_put.sh b/private_dot_local/bin/executable_clipboard_put.sh new file mode 100644 index 0000000..2edbed9 --- /dev/null +++ b/private_dot_local/bin/executable_clipboard_put.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ "${XDG_SESSION_TYPE}" = "wayland" ]; then + wl-paste +else + xsel -ob +fi diff --git a/private_dot_local/bin/executable_compiler b/private_dot_local/bin/executable_compiler new file mode 100644 index 0000000..8ab7581 --- /dev/null +++ b/private_dot_local/bin/executable_compiler @@ -0,0 +1,50 @@ +#!/bin/sh + +################## Luke's notes ################# +# This script will compile or run another finishing operation on a document. I +# have this script run via vim. + +# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent +# presentations. Runs scripts based on extension or shebang. +################################################# + +file="${1}" +[ -n "${kak_buffile}" ] && file="${kak_buffile}" +ext="${file##*.}" +dir=${file%/*} +base="${file%.*}" + +echo "$dir" +cd "${dir}" || exit "1" + +case "${ext}" in +[0-9]) preconv "${file}" | refer -PS -e | groff -mandoc -T pdf >"${base}.pdf" ;; +mom | ms) preconv "${file}" | refer -PS -e | groff -T pdf -m"${ext}" >"${base}.pdf" ;; +c) cc "${file}" -o "${base}" && "./${base}" ;; +cob) cobc -x -o "$base" "$file" && "$base" ;; +cpp) g++ "${file}" -o "${base}" && "./${base}" ;; +cs) mcs "${file}" && mono "${base}.exe" ;; +go) go run "${file}" ;; +h) sudo make install ;; +java) javac -d classes "${file}" && java -cp classes "${base}" ;; +m) octave "${file}" ;; +md) + if [ -x "$(command -v lowdown)" ]; then + lowdown --parse-no-intraemph "${file}" -s -Tms | groff -mpdfmark -ms -kept -T pdf >"${base}.pdf" + elif [ -x "$(command -v groffdown)" ]; then + groffdown -i "${file}" | groff -T pdf >"${base}.pdf" + else + pandoc -t ms --highlight-style="kate" -s -o "${base}.pdf" "${file}" + fi + ;; +org) emacs "${file}" --batch -u "${USER}" -f org-latex-export-to-pdf ;; +py) python "${file}" ;; +rink) rink -f "${file}" ;; +[rR]md) Rscript -e "rmarkdown::render('${file}', quiet=TRUE)" ;; +rs) cargo build ;; +sass) sassc -a "${file}" "${base}.css" ;; +scad) openscad -o "${base}.stl" "${file}" ;; +sent) setsid -f sent "${file}" 2>"/dev/null" ;; +tex) latexmk -pdf ;; +*) sed -n '/^#!/s/^#!//p; q' "${file}" | xargs -r -I % "${file}" ;; +esac diff --git a/private_dot_local/bin/executable_compresspdf b/private_dot_local/bin/executable_compresspdf new file mode 100644 index 0000000..c79da7e --- /dev/null +++ b/private_dot_local/bin/executable_compresspdf @@ -0,0 +1,8 @@ +#!/bin/sh + +file="${1}" +ext="${file##*.}" +base="${file%.*}" + +[ "${ext}" = "pdf" ] || exit +gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="${base}-compressed${ext}" "${file}" diff --git a/private_dot_local/bin/executable_css-httpd.sh b/private_dot_local/bin/executable_css-httpd.sh new file mode 100644 index 0000000..4f4b8c8 --- /dev/null +++ b/private_dot_local/bin/executable_css-httpd.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +PORT=4646 +CSS_FILE="/home/tom/.local/share/nb/style.css" + +while true; do + { + printf 'HTTP/1.1 200 OK\r\n' + printf 'Content-Type: text/css\r\n' + printf 'Content-Length: %d\r\n' "$(wc -c < "$CSS_FILE")" + printf 'Connection: close\r\n' + printf '\r\n' + cat "$CSS_FILE" + } | nc -l "$PORT" +done diff --git a/private_dot_local/bin/executable_get-bookmark b/private_dot_local/bin/executable_get-bookmark new file mode 100644 index 0000000..f06668d --- /dev/null +++ b/private_dot_local/bin/executable_get-bookmark @@ -0,0 +1,7 @@ +#!/bin/sh + +bm_prefix="$XDG_DATA_HOME/bookmarks" +#bm_line="$(cat "$bm_prefix"/* | grep -v '/^#/d' | dmenu -l 20)" +#bm_line="$(sed -e 'x/ .*$/d' "$bm_prefix"/* | dmenu -l 20)" +bm_line="$(cat "$bm_prefix"/* | dmenu -l 20)" +echo "${bm_line%% *}" diff --git a/private_dot_local/bin/executable_gopassmenu b/private_dot_local/bin/executable_gopassmenu new file mode 100644 index 0000000..1fa4f5f --- /dev/null +++ b/private_dot_local/bin/executable_gopassmenu @@ -0,0 +1,15 @@ +#!/bin/sh + +PW="$(gopass ls --flat | wmenu -l 10 -p 'Password: ' -f 'Liberation Mono 12px' | xargs -r gopass show -o)" +# [t]ype or copy +if [ "$1" = "-t" ] ; then + wtype "${PW}" +else + wl-copy -o "${PW}" + ( sleep 30 && wl-copy -c ) & +fi + +#gopass ls --flat | wofi -dab -k /dev/null -p "Password: " | xargs -r gopass show -o | wl-copy + +# X11 +#gopass ls --flat | dmenu -p 'Password' | xargs -r gopass show -o | xdotool type --clearmodifiers --file - diff --git a/private_dot_local/bin/executable_gousermenu b/private_dot_local/bin/executable_gousermenu new file mode 100644 index 0000000..34bbcf9 --- /dev/null +++ b/private_dot_local/bin/executable_gousermenu @@ -0,0 +1,11 @@ +#!/bin/sh + +uname="$(gopass ls --flat | wmenu -l 10 -p 'Username: ' -f 'Liberation Mono 12px')" +# [t]ype or copy +if [ "$1" = "-t" ] ; then + wtype "${uname##*/}" +else + wl-copy "${uname##*/}" + ( sleep 30 && wl-copy -c ) & +fi +#wl-copy "${uname##*/}" diff --git a/private_dot_local/bin/executable_linkmenu b/private_dot_local/bin/executable_linkmenu new file mode 100644 index 0000000..32fd8df --- /dev/null +++ b/private_dot_local/bin/executable_linkmenu @@ -0,0 +1,96 @@ +#!/bin/sh + +# If link is set in the first arg, use it +# Otherwise, read from stdin +if [ -n "$1" ]; then + link="$1" +else + read -r link +fi + +tools="type +surf +surf-incognito +firefox +firefox-private +yt-dlp +yt-dlp-pl +yt-dlp-audio +mpv +mpv-audio +type +bookmark" + +#[ "$1" = "dmenu" ] && tool="$(echo "$tools" | dmenu)" || tool="$1" # OLD VER +#tool="$(echo "$tools" | dmenu)" +tool="$(echo "$tools" | wofi -d)" + + + +# Sed scripts to clean invidious links +# Fir"$TERM" one also removes playli"$TERM" context +#ytcleaner='s|(https://).*(/watch\?v=.{11}).*|\1youtube.com\2|' +#ytcleaner2='s|\(https://\).*/|\1youtube.com/|' +yt_prefix="https://youtube.com/watch?v=" + +case $tool in +"surf") + notify-send -t 2000 "Opening in surf:" "$link" + surf -s "$link" + ;; +*surf-incognito) + notify-send -t 2000 "Opening in surf:" "$link" + surf-incognito -s "$link" + ;; +*firefox) + notify-send -t 2500 "Opening in Firefox:" "$link" + firefox "$link" + ;; +*firefox-private) + notify-send -t 2500 "Opening in Firefox private:" "$link" + firefox --private-window "$link" + ;; +*yt-dlp) + link="$yt_prefix${link##*watch?v=}" + link="${link%%&list*}" + #link="$(echo "$link" | sed -Ee "$ytcleaner")" + notify-send -t 2500 "Downloading video:" "$link" + "$TERM" -e /bin/sh -c "yt-dlp \"$link\"; sleep 5" + ;; +*yt-dlp-pl) + link="$yt_prefix${link##*watch?v=}" + #link="$(echo "$link" | sed -e "$ytcleaner2")" + notify-send -t 2500 "Downloading video:" "$link" + "$TERM" -e /bin/sh -c "yt-dlp \"$link\"; sleep 5" + ;; +*yt-dlp-audio) + link="$yt_prefix${link##*watch?v=}" + link="${link%%&list*}" + #link="$(echo "$link" | sed -Ee "$ytcleaner")" + notify-send -t 2500 "Downloading audio:" "$link" + "$TERM" -e yt-dlp -f "ba*" -x --audio-format opus --remux-video opus "$link" + ;; +*mpv) + link="$yt_prefix${link##*watch?v=}" + link="${link%%&list*}" + #link="$(echo "$link" | sed -Ee "$ytcleaner")" + notify-send -t 2500 "Playing video:" "$link" + echo "$TERM" + "$TERM" -e /bin/sh -c "mpv \"$link\"; sleep 5" + #"$TERM" -e /bin/sh -c "mpv --ao=pulse \"$link\"; sleep 5" + ;; +*mpv-audio) + link="$yt_prefix${link##*watch?v=}" + link="${link%%&list*}" + #link="$(echo "$link" | sed -Ee "$ytcleaner")" + notify-send -t 2500 "Playing audio:" "$link" + "$TERM" -e mpv --no-video "$link" + ;; +*type) + notify-send -t 1000 "Typing" "$link" + xdotool type "$link" + ;; +*bookmark) + save-bookmark "$link" + ;; +esac diff --git a/private_dot_local/bin/executable_mullvad-browser-launcher b/private_dot_local/bin/executable_mullvad-browser-launcher new file mode 100644 index 0000000..d72f180 --- /dev/null +++ b/private_dot_local/bin/executable_mullvad-browser-launcher @@ -0,0 +1,3 @@ +#!/bin/sh + +sh -c '/home/twells/.local/src/mullvad-browser/Browser/start-mullvad-browser --detatch' diff --git a/private_dot_local/bin/executable_p9start b/private_dot_local/bin/executable_p9start new file mode 100644 index 0000000..82a73c6 --- /dev/null +++ b/private_dot_local/bin/executable_p9start @@ -0,0 +1,5 @@ +#!/bin/sh + +mkdir -p /tmp/9p/fonts +mkdir -p /tmp/9p/acme +fontsrv -m /tmp/9p/fonts & diff --git a/private_dot_local/bin/executable_packages-list-arch.zsh b/private_dot_local/bin/executable_packages-list-arch.zsh new file mode 100644 index 0000000..834c130 --- /dev/null +++ b/private_dot_local/bin/executable_packages-list-arch.zsh @@ -0,0 +1,3 @@ +#!/bin/zsh + +sort <(pacman -Qqeng plasma) <(pacman -Qqen) | uniq -u diff --git a/private_dot_local/bin/executable_passmenu b/private_dot_local/bin/executable_passmenu new file mode 100644 index 0000000..76d92ab --- /dev/null +++ b/private_dot_local/bin/executable_passmenu @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +if [[ -n $WAYLAND_DISPLAY ]]; then + dmenu=dmenu-wl + xdotool="ydotool type --file -" +elif [[ -n $DISPLAY ]]; then + dmenu=dmenu + xdotool="xdotool type --clearmodifiers --file -" +else + echo "Error: No Wayland or X11 display detected" >&2 + exit 1 +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | "$dmenu" "$@") + +[[ -n $password ]] || exit + +if [[ $typeit -eq 0 ]]; then + pass show -c "$password" 2>/dev/null +else + pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool +fi diff --git a/private_dot_local/bin/executable_remaps b/private_dot_local/bin/executable_remaps new file mode 100644 index 0000000..ed60648 --- /dev/null +++ b/private_dot_local/bin/executable_remaps @@ -0,0 +1,7 @@ +#!/bin/sh + +xset r rate 300 50 + +setxkbmap -option "caps:escape" + +xset -q | grep -q "Caps Lock:\s*on" && xdotool key Caps_Lock diff --git a/private_dot_local/bin/executable_rename-fat32 b/private_dot_local/bin/executable_rename-fat32 new file mode 100644 index 0000000..25fc947 --- /dev/null +++ b/private_dot_local/bin/executable_rename-fat32 @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby +# Encoding : UTF-8 + +class RenameFAT32 + def initialize(*args) + @files = args.map do |file| + File.expand_path(file) + end + end + + def make_fat32_compliant(value) + # Remove characters not allowed in fat32 + value = value.to_s.gsub(/([\?\/\*\|:;"”“<>])/, "").strip + # Double spaces + value = value.gsub(/ {2,}/," ") + # Bad quotes + value = value.gsub('’', "'") + return value + end + + def run + @files.each do |file| + dirname = File.dirname(file) + extname = File.extname(file) + basename = File.basename(file, extname) + new_basename = make_fat32_compliant(basename) + new_file = File.join(dirname, new_basename+extname) + + File.rename(file, new_file) if file != new_file + end + + end +end +RenameFAT32.new(*ARGV).run() diff --git a/private_dot_local/bin/executable_rippy b/private_dot_local/bin/executable_rippy new file mode 100644 index 0000000..6b89d5a --- /dev/null +++ b/private_dot_local/bin/executable_rippy @@ -0,0 +1,35 @@ +#!/bin/sh + +if [ "$1" = "-o" ]; then + shift + offset="$1" +fi + +cd "$HOME"/media/music || exit + +abcde -po flac,mp3 || exit + +echo "Ripped successfully" + +dir="$(eza -rs created | head -n1)" +new="../mp3-mirror/$dir-mp3" + +if [ -n "$offset" ]; then + for i in "$dir"/*; do + song_name="${i#*.}" + song_num="${i%%.*}" + song_num="${song_num##*/}" + song_num="${song_num#*0}" + + new_fname="$(printf "%s/%02d.%s\n" "${i%%/*}" "$((song_num + offset + 1))" "$song_name")" + mv "$i" "$new_fname" + done +fi + + +sleep 1 + +[ "$(mkdir ../mp3-mirror/"$new")" ] || printf "\e[0;33mmp3 directory already exists\nCopying files to existing directory\n\e[0m" +mv -v "$dir"/*.mp3 "$new" + +printf "\e[0;32mmp3 mirror successful\e[0m\n" diff --git a/private_dot_local/bin/executable_rmdc b/private_dot_local/bin/executable_rmdc new file mode 100644 index 0000000..0995f61 --- /dev/null +++ b/private_dot_local/bin/executable_rmdc @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "require(rmarkdown); render('$1')" | R --vanilla diff --git a/private_dot_local/bin/executable_save-bookmark b/private_dot_local/bin/executable_save-bookmark new file mode 100644 index 0000000..343a002 --- /dev/null +++ b/private_dot_local/bin/executable_save-bookmark @@ -0,0 +1,15 @@ +#!/bin/sh + +bm_dir="$XDG_DATA_HOME/bookmarks" +if [ -n "$1" ]; then + bm="$1" +else + read -r bm +fi + +if grep -q "^$bm" "$bm_dir"/*; then + notify-send -t 3000 "$bm Already bookmarked" "No new bookmark was added" +else + echo "$bm" >>"$bm_dir/in_bm" + notify-send -t 3000 "$bm Bookmarked successfully" "New bookmark was added" +fi diff --git a/private_dot_local/bin/executable_shst b/private_dot_local/bin/executable_shst new file mode 100644 index 0000000..68fc260 --- /dev/null +++ b/private_dot_local/bin/executable_shst @@ -0,0 +1,6 @@ +#! /bin/sh + +while true; do + xsetroot -name "$(status.sh)" + sleep 3 +done diff --git a/private_dot_local/bin/executable_simenv b/private_dot_local/bin/executable_simenv new file mode 100644 index 0000000..9cde705 --- /dev/null +++ b/private_dot_local/bin/executable_simenv @@ -0,0 +1,2 @@ +#!/bin/sh +tmux new-session -d -s simulator -c "/home/tom/kipr_sources/Simulator" 'toolbox enter -d ubuntu -r 22.04; zsh'\; split-window -h 'toolbox enter -d ubuntu -r 22.04; zsh'\; new-window -t simulator -c "/home/tom/kipr_sources/database" 'toolbox enter -d ubuntu -r 22.04;zsh'\; split-window -c "/home/tom/kipr_sources/database" -h 'toolbox enter -d ubuntu -r 22.04; zsh'\; diff --git a/private_dot_local/bin/executable_status.sh b/private_dot_local/bin/executable_status.sh new file mode 100644 index 0000000..edbb015 --- /dev/null +++ b/private_dot_local/bin/executable_status.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +#VOL="$(wpctl get-volume @DEFAULT_SINK@ | awk '{print $2}')" +VOL="$(wpctl get-volume @DEFAULT_SINK@)" +VOL="${VOL#* }" +#VOL="${VOL% *}" + +DATE=$(date +"%a %b %d %I:%M %p") + +MEM="$(free -m | awk '/^Mem/{print $3}') MiB" + +#CPU_LOAD="CPU: $(awk '{print $1}' /proc/loadavg)" +read -r CPU_LOAD < /proc/loadavg +CPU_LOAD="${CPU_LOAD%% *}" + +read -r CPU_TEMP < /sys/class/thermal/thermal_zone0/temp +CPU_TEMP="$(($CPU_TEMP/1000))" + +#BAT="$(cat /sys/class/power_supply/BAT1/capacity)%" +read -r BAT < /sys/class/power_supply/BAT1/capacity + +echo "$VOL | $CPU_LOAD | ${CPU_TEMP} C | $MEM | $BAT% | $DATE" diff --git a/private_dot_local/bin/executable_surf-get-url b/private_dot_local/bin/executable_surf-get-url new file mode 100644 index 0000000..0e667d9 --- /dev/null +++ b/private_dot_local/bin/executable_surf-get-url @@ -0,0 +1,3 @@ +#!/bin/sh + +xprop -id "$1" _SURF_URI | sed -e 's/_SURF_URI(UTF8_STRING) = \"\(.*\)\"/\1/' -e 's/\\\\\\(.\\)/\\1/g' diff --git a/private_dot_local/bin/executable_timer b/private_dot_local/bin/executable_timer new file mode 100644 index 0000000..1f53743 --- /dev/null +++ b/private_dot_local/bin/executable_timer @@ -0,0 +1,17 @@ +#!/bin/sh + +remaining="$1" + +while [ "$remaining" -gt 0 ]; do + printf '%s\r' "$(date -ud "@$remaining" +%T)" + remaining="$((remaining - 1))" + sleep 1 +done + +#mpv --really-quiet ~/media/music/Sabaton-The_Last_Stand/10.Winged_Hussars.flac +#mpv --really-quiet ~/media/old-church-bell-6298.mp3 & +#sleep 2 +#mpv --really-quiet ~/media/old-church-bell-6298.mp3 & +#sleep 2 +#mpv --really-quiet ~/media/old-church-bell-6298.mp3 & +#sleep 2 diff --git a/private_dot_local/bin/executable_vid2opus b/private_dot_local/bin/executable_vid2opus new file mode 100644 index 0000000..5e461a9 --- /dev/null +++ b/private_dot_local/bin/executable_vid2opus @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +tmp="$(mktemp --suffix='.png')" +trap "rm ${tmp}" INT EXIT QUIT TERM ABRT + +new="${1%.*}.opus" + +ffmpegthumbnailer -i "$1" -s0 -q10 -m -o "${tmp}" +ffmpeg -i "$1" -c:a copy -c:v none -c:s none "${new}" +opustags -i --set-cover "${tmp}" "${new}" diff --git a/private_dot_local/bin/executable_vpn b/private_dot_local/bin/executable_vpn new file mode 100644 index 0000000..f3dc0b1 --- /dev/null +++ b/private_dot_local/bin/executable_vpn @@ -0,0 +1,31 @@ +#!/bin/sh + +if [ "$(id -u)" != "0" ]; then + echo "Must be run as root" + exit 1 +fi + +# This script assumes you have some $XDG_RUNTIME_DIR set up. +# The easiest way is systemd/elogind. +FNAME="/run/user/1000/vpn" + +# Toggle vpn +if [ -e "$FNAME" ]; then + read -r IF < /run/user/1000/vpn + echo "Bringing $IF down..." + wg-quick down "$IF" + rm "$FNAME" +else + IF="$(find /etc/wireguard -type f -name "us-*" | shuf -n 1)" + echo "Bringing $IF up..." + wg-quick up "$IF" + echo "$IF" > $FNAME +fi + +# Shorthand to [s]witch to a new server +if [ "$1" = "-s" ] ; then + vpn +else + true +fi + diff --git a/private_dot_local/bin/executable_wl-get-bm b/private_dot_local/bin/executable_wl-get-bm new file mode 100644 index 0000000..c7aff34 --- /dev/null +++ b/private_dot_local/bin/executable_wl-get-bm @@ -0,0 +1,3 @@ +#!/bin/sh + +cat ~/.local/share/bookmarks/* | wofi -d | wl-copy diff --git a/private_dot_local/bin/executable_workout.sh b/private_dot_local/bin/executable_workout.sh new file mode 100644 index 0000000..e6d4579 --- /dev/null +++ b/private_dot_local/bin/executable_workout.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +for i in {0..51}; do + echo "Do $((1 + $RANDOM % 10))" + echo "Of $((1 + $RANDOM % 4))" + read -p "Press Enter to continue"