major springcleaning

This commit is contained in:
2023-10-12 15:12:12 +02:00
parent 648a010f64
commit 98b48cb97b
332 changed files with 6708 additions and 10208 deletions

View File

@ -0,0 +1,23 @@
#!/bin/sh
# A wrapper for the arkenfox-updater that runs it on all pre-existing Arkenfox
# user.js files on the machine.
# On installation of LARBS, this file is copied to /usr/local/lib/ where it is
# run by a pacman hook set up. The user should not have to run this manually.
# Search for all Firefox and Librewolf profiles using Arkenfox.
profiles="$(grep -sH "arkenfox user.js" \
/home/*/.librewolf/*.default-release/user.js \
/home/*/.mozilla/firefox/*.default-release/user.js)"
IFS='
'
# Update each found profile.
for profile in $profiles; do
userjs=${profile%%/user.js*}
user=$(stat -c '%U' "$userjs") || continue
su -l "$user" -c "arkenfox-updater -c -p $userjs -s"
done

43
.local/bin/tools/booksplit Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh
# Requires ffmpeg
[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit
echo "Enter the album/book title:"; read -r booktitle
echo "Enter the artist/author:"; read -r author
echo "Enter the publication year:"; read -r year
inputaudio="$1"
ext="${1##*.}"
# Get a safe file name from the book.
escbook="$(echo "$booktitle" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
! mkdir -p "$escbook" &&
echo "Do you have write access in this directory?" &&
exit 1
# Get the total number of tracks from the number of lines.
total="$(wc -l < "$2")"
cmd="ffmpeg -i \"$inputaudio\" -nostdin -y"
while read -r x;
do
end="$(echo "$x" | cut -d' ' -f1)"
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
if [ -n "$start" ]; then
cmd="$cmd -metadata artist=\"$author\" -metadata title=\"$title\" -metadata album=\"$booktitle\" -metadata year=\"$year\" -metadata track=\"$track\" -metadata total=\"$total\" -ss \"$start\" -to \"$end\" -vn -c:a copy \"$file\" "
fi
title="$(echo "$x" | cut -d' ' -f2-)"
esctitle="$(echo "$title" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
track="$((track+1))"
start="$end"
done < "$2"
# Last track must be added out of the loop.
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
cmd="$cmd -metadata artist=\"$author\" -metadata title=\"$title\" -metadata album=\"$booktitle\" -metadata year=\"$year\" -metadata track=\"$track\" -ss \"$start\" -vn -c copy \"$file\""
eval "$cmd"

View File

@ -1 +0,0 @@
MX Master

View File

@ -1,77 +0,0 @@
#!/bin/bash
#wait time to discover new devices in seconds
SCAN_PERIOD=5
BLACKLIST=$HOME/.local/bin/tools/bt_blacklist
actions="turn off\nturn on\npair\nunpair"
#Checks for necessary programs to be present. Very unlikely not to be present but let's just err on the safer side.
for prog in dmenu bluetoothctl awk cat; do
if ! hash "$prog" 2>/dev/null; then
printf 'bthandler: %s: command not found\n' "$prog" >&2
exit 127
fi
done
bluetoothctl paired-devices | awk '{print $2}' > /tmp/bt_IDS
bluetoothctl paired-devices | awk '{for (i=3; i<NF; i++) printf $i " "; print $NF}' > /tmp/paired_devices
grep -vf "$BLACKLIST" /tmp/paired_devices > /tmp/disp_devices
#Don't print empty device list, removes unnecessary empty choice in dmenu
len=$(cat /tmp/disp_devices | wc -l)
[ $len -gt 0 ] && choice=$( printf "$(< /tmp/disp_devices)\n$actions" | dmenu -i -p 'What BT action would you like to perform:' )
[ $len -eq 0 ] && choice=$( printf "$actions" | dmenu -i -p 'What BT action would you like to perform:' )
cleanup(){
rm -f /tmp/bt_devices
rm -f /tmp/bt_IDS
rm -f /tmp/paired_devices
rm -f /tmp/new_devices
rm -f /tmp/disp_devices
bluetoothctl scan off > /dev/null
exit
}
case $choice in
"turn on") bluetoothctl power on
cleanup;;
"turn off") bluetoothctl power off
cleanup;;
"scan on") bluetoothctl power on && echo power on && sleep 2
[ -n $TERMINAL ] && ($TERMINAL -e bluetoothctl scan on ) || st bluetoothctl scan on
cleanup;;
"pair") bluetoothctl power on
bluetoothctl scan on & disown
notify-send "Bluetooth" "Searching for devices, please wait a bit"
sleep $SCAN_PERIOD
bluetoothctl devices | awk '{for (i=3; i<NF; i++) printf $i " "; print $NF}' > /tmp/bt_devices
grep -vf /tmp/paired_devices /tmp/bt_devices > /tmp/new_devices
choice=$( cat /tmp/new_devices | dmenu -l 10 -i -p 'pair with which device?' )
if [ -n "$choice" ]; then
bluetoothctl devices | awk '{print $2}' > /tmp/bt_IDS
dev_no=$(cat -n /tmp/bt_devices | grep "$choice" | awk '{print $1}')
dev_id=$(cat -n /tmp/bt_IDS | grep -E $dev_no"[[:space:]]" | awk '{print $2}' )
bluetoothctl pair $dev_id && sleep 2
bluetoothctl connect $dev_id
fi
cleanup;;
"unpair") choice=$( cat /tmp/paired_devices | dmenu -l 10 -i -p 'remove which paired device?')
if [ -n "choice" ]; then
dev_no=$(cat -n /tmp/paired_devices | grep "$choice" | awk '{print $1}')
dev_id=$(cat -n /tmp/bt_IDS | grep -E $dev_no"[[:space:]]" | awk '{print $2}' )
bluetoo
bluetoothctl remove $dev_id
fi
cleanup;;
esac
if [ -n "$choice" ]; then
dev_no=$(cat -n /tmp/paired_devices | grep "$choice" | awk '{print $1}')
dev_id=$(cat -n /tmp/bt_IDS | grep $dev_no | awk '{print $2}')
bluetoothctl power on
bluetoothctl connect $dev_id
fi
cleanup

View File

@ -1,12 +0,0 @@
#!/bin/bash
video=$1
speed=${2:-1}
echo "speed: $speed"
slowness="$( echo $speed | bc -l )"
echo "slowness: $slowness"
rate=$( ffmpeg -i $video | sed -n "s/.*, \(.*\) tbr.*/\1/p" )
echo "oldrate: $rate"
newrate=$( echo "scale=0; $speed * $rate" | bc -l )
echo "newrate: $newrate"
command=ffmpeg -re -i "$video" -r $newrate filter:v "setpts=$slowness*PTS" pipe:1
mkchromecast --video --control --command "$command"

View File

@ -1,2 +1,2 @@
#!/bin/sh
mkchromecast --notifications --video --control -y $1 2>/dev/null || true
mkchromecast --video --control -y $1 2>/dev/null || true

View File

@ -1,2 +0,0 @@
#!/bin/sh
xclip -o -selection "clipboard"

View File

@ -1,10 +0,0 @@
#!/bin/sh
filepath_remote="$(echo "$1" | sed 's/\[/\\[/g; s/\\]/\\]/g')"
filename="${1##*/}"
remote=rezepte.bocken.org
notify-send "Downloading $filename"
download_path="$HOME/dls"
download_file="$download_path/$filename"
rsync -rvPu "root@$remote:$filepath_remote" "$download_file"
clear
rifle "$download_file" || ranger $download_path

View File

@ -11,14 +11,14 @@ makepathabsolute(){
echo "$dl_location"
}
choices="$(printf 'mpv\\ncopy url\\nqueue download\\nrifle file\\nqueue youtube-dl\\nbrowser\\nrip media\\ncast')"
choices="$(printf 'mpv\ncopy url\nqueue download\nrifle file\nqueue youtube-dl\nbrowser\nrip media\ncast')"
if echo "$1" | grep -q "4chan"; then
choices="$(printf '%s\\nwatch thread' "$choices")"
choices="$(printf '%s\nwatch thread' "$choices")"
fi
choice="$(echo "$choices" | dmenu -i -p "Open link with what program?")"
case "$choice" in
"copy url") echo "$1" | xclip -selection clipboard ;;
mpv) setsid mpv --quiet --ytdl-format='bestvideo[height<=1080]+bestaudio/best[height<=1080]' "$1" & ;;
mpv) setsid mpv --quiet --ytdl-format='bestvideo[height<=1080]+bestaudio/best[height<=1080]' --force-window=yes "$1" & ;;
"mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;;
"queue download") name="$( dmenuinput 'Name for file:' )"
[ -z "$name" ] && tsp curl -C - -LO "$1" >/dev/null 2>&1
@ -32,7 +32,7 @@ case "$choice" in
#"mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
"rifle file") curl -L "$1" -o "/tmp/riflefile"
rifle /tmp/riflefile;;
"watch thread") dest="$(dmenuinput 'name of folder:')"
"watch thread") dest="$(find $HOME -maxdepth 5 -type d -not -path "$HOME/.*" | dmenu -i -p 'name of folder:')"
[ -z "$dest" ] && exit
echo "dmenuhandler:$dest"
mkdir -p "$(makepathabsolute "$dest")"

View File

@ -1,6 +0,0 @@
#!/bin/sh
input=$1
while read -r str
do
[[ $(grep -c "$str" "$input") == 1 ]] && echo $str
done < "$input"

View File

@ -1,3 +0,0 @@
#!/bin/sh
pdf="$(du -a --time ETH/ | awk '!($1="")' | sort -r | grep '\.pdf' | awk '!($1="")' | awk '!($1="")' | sed 's/^ //' | dmenu -l 20 )"
[ -z $pdf ] || $READER "$pdf"

View File

@ -1 +0,0 @@
/home/alex/.local/bin/tools/extract

View File

@ -1,3 +0,0 @@
Device 00:00:00:00:3F:F3 TOZO-T10-R
Device 00:00:00:00:3F:F3 TOZO-T10-R

View File

@ -1,4 +0,0 @@
#!/bin/sh
cat ~/.config/getkeys/"$1" 2>/dev/null && exit
echo "Run command with one of the following arguments for info about that program:"
ls ~/.config/getkeys

View File

@ -0,0 +1,2 @@
#!/bin/sh
name=$1 GOMUKS_CACHE_HOME="$XDG_CACHE_HOME/gomuks_$name" GOMUKS_CONFIG_HOME="$XDG_CONFIG_HOME/gomuks_$name" GOMUKS_DATA_HOME="$XDG_DATA_HOME/gomuks_$name" DEBUG_DIR="/tmp/gomuks_$name" GOMUKS_DOWNLOAD_HOME="$HOME" gomuks

View File

@ -26,7 +26,7 @@ screenheight="$( echo "$dim" | grep -Eo 'x[0-9]{1,5}+' | tr -d 'x+')"
newheight=$(( 2 * screenheight / 5 ))
newwidth=$(( 2 * screenwidth / 5 ))
# fit your borderwidth setup of your WM or windows could bleed over to other display
borderwidth=2
borderwidth=1
# see https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html for gravity specs
# I do not believe that gravity is being respected in dwm.

View File

@ -1,13 +0,0 @@
#!/bin/bash
#arg 1: xlsx file
current_dir="$pwd"
cd $HOME/src/GRE/
find *.xlsx | xargs git rm
find *.csv | xargs git rm
cd "$current_dir"
xlsx2csv -d 'tab' $1 | tail -n +3 > "$HOME/src/GRE/${1%xlsx}csv"
mv $1 $HOME/src/GRE
cd $HOME/src/GRE/
git add "$1"
git add "${1%xlsx}csv"
cd "$current_dir"

View File

@ -1,23 +0,0 @@
#!/bin/sh
# macho - an interactive man page finder using fzf
# from: https://hiphish.github.io/blog/2020/05/31/macho-man-command-on-steroids/
while getopts ":s:" opt; do
case $opt in
s ) SECTION=$OPTARG; shift; shift;;
\?) echo "Invalid option: -$OPTARG" >&2; exit 1;;
: ) echo "Option -$OPTARG requires an argument" >&2; exit 1;;
esac
done
manual=$(apropos -s ${SECTION:-''} ${@:-.} | \
grep -v -E '^.+ \(0\)' |\
awk '{print $2 " " $1}' | \
sort | \
dmenu -i -l 20 -p "Manual: " | \
sed -E 's/^\((.+)\)/\1/')
echo $manual
[ -z "$manual" ] && exit 0;
man -T"${FORMAT:-pdf}" $manual | ${READER:-zathura} -

51
.local/bin/tools/nsxiv-rifle Executable file
View File

@ -0,0 +1,51 @@
#!/bin/sh
TMPDIR="${TMPDIR:-/tmp}"
tmp="$TMPDIR/nsxiv_rifle_$$"
is_img_extension() {
grep -iE '\.(jpe?g|png|gif|svg|webp|tiff|heif|avif|ico|bmp)$'
}
listfiles() {
find -L "$1" -maxdepth 1 -type f -print |
is_img_extension | sort | tee "$tmp"
}
open_img() {
file="$1"; shift;
# only go through listfiles() if the file has a valid img extension
if echo "$file" | is_img_extension >/dev/null 2>&1; then
trap 'rm -f $tmp' EXIT
count="$(listfiles "///${file%/*}" | grep -nF "$file")"
fi
if [ -n "$count" ]; then
nsxiv -i -n "${count%%:*}" "$@" -- < "$tmp"
else
# fallback incase file didn't have a valid extension, or we couldn't
# find it inside the list
nsxiv "$@" -- "$file"
fi
}
uri2path() {
python3 - "$@" <<'___HEREDOC'
from urllib.parse import unquote, urlparse
from sys import argv
for arg in argv[1:]:
print(unquote(urlparse(arg).path))
___HEREDOC
}
[ "$1" = '--' ] && shift
case "$1" in
"") echo "Usage: ${0##*/} PICTURES" >&2; exit 1 ;;
/*) open_img "$1" ;;
"~"/*) open_img "$HOME/${1#"~"/}" ;;
file:///*) open_img "$(uri2path "$1")" ;;
trash:///*)
trash_dir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash/files"
open_img "${trash_dir}$(uri2path "$1")" -N "nsxiv_trash"
;;
*) open_img "$PWD/$1" ;;
esac

View File

@ -1,11 +0,0 @@
#!/bin/sh
# opout: "open output": A general handler for opening a file's intended output.
# I find this useful especially running from vim.
basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
case "$1" in
*.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;;
*.html) setsid "$BROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;;
*.sent) setsid sent "$1" >/dev/null 2>&1 & ;;
esac

View File

@ -15,6 +15,7 @@ DONE=0
LEVEL=0
PREVSELECTION=""
SELECTION=""
DEFAULT_USER="alexander@bocken.org"
while [ "$DONE" -eq 0 ] ; do
password_files=( "$STARTDIR"/* )
@ -48,7 +49,15 @@ while [ "$DONE" -eq 0 ] ; do
pass otp show -c "$SELECTION" > $HOME/.cache/passstring
else
pass show -c "$SELECTION" > $HOME/.cache/passstring
pass show "$SELECTION" | awk 'NR == 2 {print $NF}' | xclip -r -i -selection primary
if [ $? -eq 0 ]; then
var=$(pass show "$SELECTION" | awk 'NR == 2 {print $NF}')
if [ -z $var ]; then
var=$DEFAULT_USER
fi
echo $var | xclip -r -i -selection primary
else
exit 1
fi
fi
sed -e "s/^/\"/" -e "s/$/\"/" $HOME/.cache/passstring | xargs -r notify-send "Password" -t 4000
sleep 45

View File

@ -1,2 +0,0 @@
#!/bin/sh
sudo sed -i '/case "$(readlink -f \/sbin\/init)" in/,+2d' $(which mailsync)

View File

@ -1,4 +0,0 @@
#!/bin/sh
for i in $(ls /tmp/mpvsoc*); do
echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
done

View File

@ -1,30 +0,0 @@
#!/bin/sh
if [ $# -eq 1 ]; then
A=0
B=1
F="$( echo "$1" | sed -E 's/\"//g' )"
elif [ $# -eq 2 ]; then
A=0
B="$1"
F="$( echo "$2" | sed -E 's/\"//g' )"
elif [ $# -eq 3 ]; then
A="$1"
B="$2"
F="$( echo "$3" | sed -E 's/\"//g' )"
else
echo "Please use 1,2 or 3 arguments for plotting"
exit
fi
python -c "from numpy import *
import matplotlib.pyplot as plt
def plot(a, b, f):
x = linspace(a, b, 1000)
y = eval(f)
plt.plot(x, y)
plt.show()
plot($A,$B,\"$F\")"

View File

@ -1,7 +0,0 @@
#!/bin/bash
# Required if run as a cronjob:
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
export PASSWORD_STORE_GPG_OPTS="--homedir=$HOME/.local/share/gnupg"
export PASSWORD_STORE_DIR="$HOME/.local/share/password-store"
ping 1.1.1.1 -c 1 && owncloudcmd -s -u abocken -p "$(pass ETH/nETHz\ -\ abocken@ethz.ch)" $HOME/eth/polybox https://polybox.ethz.ch

5
.local/bin/tools/print_zine Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
PRINTER="Canon-MF220"
#PRINTER=Virtual_PDF_Printer
a5ona4 "$1"
lpr -P $PRINTER -o media=A4 -o Duplex=DuplexTumble -o sides=two-sided-short-edge -o BindEdge=Bottom -o media=a4 -r "a5ona4_$1"

View File

@ -1,19 +0,0 @@
#!/bin/bash
passmenu2
#group=$(pass list | sed 's/\x1B\[[0-9;]\+[A-Za-z]//g' | grep -Ev "Password|mutt-wizard" | grep -v ' .──' | sed -E 's/├──|└──| //' | sed 's/ //' | dmenu -l 20 -p 'choose group:')
#
#if [ -n "$group" ]
#then
# account=$(pass list "$group" | sed 1d | sed -E 's/├──|└──| //'| sed 's/ //' | dmenu -l 20 -p "choose account from $group:")
#
# if [ -n "$account" ]
# then
# temp="$group/$account"
# echo "$temp"
# pass -c "$temp" > $HOME/.cache/passstring
# sed -e "s/^/\"/" -e "s/$/\"/" $HOME/.cache/passstring | xargs notify-send "Password"
# rm $HOME/.cache/passstring
# sleep 45
# notify-send "Password" "password cleared from clipboard"
# fi
#fi

View File

@ -1,11 +0,0 @@
#!/bin/sh
# $1 is a url; $2 is a command
[ -z "$1" ] && exit
base="$(basename "$1")"
notify-send "⏳ Queuing $base..."
cmd="$2"
[ -z "$cmd" ] && cmd="youtube-dl --add-metadata"
idnum="$(tsp $cmd "$1")"
realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
tsp -D "$idnum" mv "$base" "$realname"
tsp -D "$idnum" notify-send "👍 $realname done."

View File

@ -1,13 +0,0 @@
#!/bin/sh
# Podboat sucks. This script replaces it.
# It reads the newsboat queue, queuing downloads with taskspooler.
# It also removes the junk from extentions.
queuefile="$HOME/.local/share/newsboat/queue"
while read -r line; do
[ -z "$line" ] && continue
url="$(echo "$line" | awk '{print $1}')"
qndl "$url" "curl -LO"
done < "$queuefile"
echo > "$queuefile"

View File

@ -1,5 +0,0 @@
#!/usr/bin/env sh
# Refresh the dwmbar.
# Send SIGTRAP signal to dwmbar script, which will handle it with a trap.
pkill -SIGTRAP dwmbar

View File

@ -1,3 +0,0 @@
#!/bin/sh
pkill $1
setsid $1

View File

@ -1,4 +0,0 @@
#!/bin/sh
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
base="$(basename $1)"
ls "$PWD" | awk "BEGIN { lines = \"\"; m = 0; } /^$base$/ { m = 1; } { if (!m) { if (lines) { lines = lines\"\n\"; } lines = lines\"\"\$0; } else { print \$0; } } END { print lines; }"

View File

@ -1,3 +0,0 @@
#!/bin/sh
categories=$(( $(cat $1 | grep -oE '[0-9]*$' | wc -l ) - 1 ))
grep -oE '[0-9]*$' $1 | head -n $categories | paste -sd+ | bc

View File

@ -1 +0,0 @@
find -iname "*$1*"

View File

@ -1,12 +1,10 @@
#!/bin/sh
# Gives a dmenu prompt to search DuckDuckGo.
# Without input, will open DuckDuckGo.com.
# Gives a dmenu prompt to searx
# Without input, will open mainpage.
# URLs will be directly handed to the browser.
# Anything else, it search it.
mainpage="https://duckduckgo.com"
searchpage="https://duckduckgo.com/?q=%s"
mainpage="https://bocken.org/searx"
searchpage="https://bocken.org/searx/search?q=%s"
browser=${BROWSER:-firefox}
if [ -z "$(xclip -o -selection clipboard)" ]; then
choice=$(printf "🔍\n" | dmenu -i -p "Searx:") || exit 1
else

View File

@ -0,0 +1,3 @@
#!/bin/sh
abook --config /home/alex/.config/abook/abookrc --datafile /home/alex/.local/share/abook/addressbook --mutt-query "" |
dmenu -l 10 | perl -pe 's/([^\t]*)\t([^\t]*)/\1 <\2>/'

View File

@ -1,26 +0,0 @@
#!/bin/bash
# Output locations. Unactivated progs should go to /dev/null.
shell_shortcuts="$HOME/.config/shortcutrc"
ranger_shortcuts="/dev/null"
qute_shortcuts="/dev/null"
fish_shortcuts="/dev/null"
vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts"
# Remove, prepare files
rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null
printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
# Format the `bmdirs` file in the correct syntax and sent it to all three configs.
sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
>(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \
>(awk '{print "map g" $1, ":cd", $2 "<CR>\nmap t" $1, "<tab>:cd", $2 "<CR><tab>\nmap M" $1, "<tab>:cd", $2 "<CR><tab>:mo<CR>\nmap Y" $1, "<tab>:cd", $2 "<CR><tab>:co<CR>" }' >> "$vifm_shortcuts") \
>(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \
| awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts"
# Format the `configs` file in the correct syntax and sent it to both configs.
sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
>(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \
>(awk '{print "map", $1, ":e", $2 "<CR>" }' >> "$vifm_shortcuts") \
| awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"

View File

@ -5,7 +5,7 @@ if echo "$1" | grep -qE 'youtube.*list'; then
js_playlist_index_loc="$HOME/src/youtube-playlist-video-ids"
# The above mentioned script needs Youtube API access, (see the repo for more info on that)
# I've saved my API key in my password manager, I reccomend you to do something similar.
API_key="$(pass show 'Misc/Youtube Data API v3' | head -n1 )"
API_key="$(pass show 'dev/Youtube Data API v3' | head -n1 )"
index="$(echo "$1" | perl -pe "s|&index=([0-9]+)|\1|")"
playlist_id="$( echo "$1" | perl -pe "s|^.*?(\?\|&)list=(.*?)|\2|; s|&index=[0-9]+||" )"
notify-send "startmpv" "Searching for all videos in playlist..."

View File

@ -1,2 +0,0 @@
#!/bin/sh
sh /opt/zoom/zoom.sh

View File

@ -1,3 +0,0 @@
#!/bin/bash
bluetoothctl power on
bluetoothctl scan on

View File

@ -1,2 +0,0 @@
#!/bin/sh
xclip -o -selection "primary" | xclip -i -selection 'clipboard'

View File

@ -6,6 +6,6 @@
host=https://new.bocken.org:443/transmission
user=alex
password=$(pass show server/transmission)
password=$(pass show server/seenas/transmission)
transmission-remote $host -n $user:$password -a "$@" && notify-send "🔽 Torrent added."
pkill -RTMIN+12 dwmblocks

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
[ -z "$FIFO_UEBERZUG" ] && exit
readonly ID_PREVIEW="preview"
if [ "$1" = "draw" ]; then
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="${PWD}/$6") > "$FIFO_UEBERZUG"
elif [ "$1" = "videopreview" ]; then
[ ! -f "/tmp/$6.png" ] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp/$6.png" -s 0 -q 10 &&
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="/tmp/$6.png") > "$FIFO_UEBERZUG"
else
declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") > "$FIFO_UEBERZUG"
fi

View File

@ -1,5 +1,5 @@
#!/bin/bash
pgrep openconnect > /dev/null && if ping -c 1 -W 1 -q webprint.ethz.ch > /dev/null
pgrep openconnect > /dev/null || if ping -c 1 -W 1 -q webprint.ethz.ch > /dev/null
then
printf '🔬'
fi

View File

@ -1,15 +0,0 @@
#!/usr/bin/env sh
export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}"
cleanup() {
rm "$FIFO_UEBERZUG" 2>/dev/null
pkill -P $$ 2>/dev/null
}
rm "$FIFO_UEBERZUG" 2>/dev/null
mkfifo "$FIFO_UEBERZUG"
trap cleanup EXIT
tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash &
vifm
cleanup

View File

@ -1,26 +0,0 @@
#!/bin/bash
HOME=$(tput cup 0 0)
ED=$(tput ed)
EL=$(tput el)
printf '%s%s' "$HOME" "$ED"
cleanup(){
tput cnorm
exit
}
trap cleanup INT
tput civis
while true
do
ROWS=$(tput lines)
COLS=$(tput cols)
CMD="$*"
${SHELL:=sh} -c "$CMD" | head -n $ROWS | while IFS= read LINE; do
printf '%-*.*s%s\n' $COLS $COLS "$LINE" "$EL"
done
printf '%s%s' "$ED" "$HOME"
sleep 0.2
done
tput cnorm

View File

@ -1,11 +0,0 @@
#!/bin/sh
videos="/tmp/videos$$"
du -a ~/vids/* ~/dls/* --time | awk '!($1="")' | sort -bgr -k1 | awk '!($1="")' | awk '!($1="")' | sed 's/^ //' | grep -v "$(find ~/vids/* ~/dls/* -type d | sed 's/$/\$/; s/\[/\\[/g; s/\]/\\]/g')" | sed "s|$HOME|\~|" > $videos
path="$(dmenu -i -l 30 -p "Choose a video to watch:" <"$videos" | sed "s|\~|$HOME|")"
rm "$videos"
if [ -n "$path" ];then
echo "$path" |
while read -r pathfile; do
rifle "$pathfile" &
done
fi