diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/common/ytclipo | 1 | ||||
| -rwxr-xr-x | bin/extra/aivpn | 15 | ||||
| -rwxr-xr-x | bin/extra/curszip | 17 | ||||
| -rwxr-xr-x | bin/extra/dbnewg | 11 | ||||
| -rwxr-xr-x | bin/extra/ehbtodl | 14 | ||||
| -rwxr-xr-x | bin/extra/gml | 70 | ||||
| -rwxr-xr-x | bin/extra/pomo | 31 | ||||
| -rwxr-xr-x | bin/extra/supd | 38 | ||||
| -rwxr-xr-x | bin/guiscripts/fillpass | 15 | ||||
| -rwxr-xr-x | bin/guiscripts/linkhandler | 9 | ||||
| -rwxr-xr-x | bin/guiscripts/locker | 2 | ||||
| -rwxr-xr-x | bin/guiscripts/newwal | 4 | ||||
| -rwxr-xr-x | bin/menuscripts/mpower | 7 | 
13 files changed, 207 insertions, 27 deletions
diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 6da7059..567e357 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -19,6 +19,7 @@ notify-send "ytclipo" "<b>downloading</b> $inp" || :  yt-dlp "$inp" \  	--restrict-filenames \ +	--embed-chapters \  	-f "b" \  	-S "res:1080" \  	-P "$HOME/vids/youtube/" \ diff --git a/bin/extra/aivpn b/bin/extra/aivpn index 55e013a..fd72ffb 100755 --- a/bin/extra/aivpn +++ b/bin/extra/aivpn @@ -4,7 +4,7 @@ logn() { printf "%s\n" "$@"; }  if [ "$1" = "-k" ]  then -	pgrep -f -- "ssh.*-L.*mc-wd" | +	pgrep -f -- "ssh.*-L.*vm" |  		xargs kill  	exit  fi @@ -21,16 +21,21 @@ keyadd ehb/ai  export SSH_ASKPASS="$0"  export SSH_ASKPASS_REQUIRE="prefer" -export PASSWORD=aluc +export PASSWORD=zot/qemu + +logn "I: Waiting for connectivity..." +while ! ssh -o ConnectTimeout=1 -o BatchMode=yes vm 2>&1 | grep -q "Permission denied" +do sleep 1 +done  logn "I: Activating vpn" -# ssh mc-wd "rasdial \"vpn.student.ehb.be\" \"luca.raymaekers@student.ehb.be\" \"$(pass school/login.ehb.be)\"" +ssh vm "rasdial \"vpn.student.ehb.be\""  ssh -f -N \  	-L 2222:10.2.160.41:22 \ -	mc-wd +	vm  ssh -t \  	-L 8188:localhost:8188 \ -	mc-wd \ +	vm \  	ssh -N -L 8188:localhost:8188 luca@10.2.160.41  logn "[8188], [2222]" diff --git a/bin/extra/curszip b/bin/extra/curszip new file mode 100755 index 0000000..6ab99e8 --- /dev/null +++ b/bin/extra/curszip @@ -0,0 +1,17 @@ +#!/bin/sh + +list1() { find "$1" -mindepth 1 -maxdepth 1 -type "${2:-d}" -printf '%f\n'; } + +curs="$(list1 ~/docs/school/Vakken | fzf)" +[ "$curs" ] || exit 1 +zip="$(list1 ~/dl f | fzf -f "$curs" | grep '\.zip$')" +[ "$zip" ] || exit 1 + +>&2 printf "zip: %s\n" "$zip" + +cd -- ~/docs/school/Vakken/"$curs" || exit 1 +rm -rf Cursus +mv -- ~/dl/"$zip" . +unzip -- "./$zip" +mv -- "${zip%%.zip}" Cursus +rm -- "$zip" diff --git a/bin/extra/dbnewg b/bin/extra/dbnewg new file mode 100755 index 0000000..a8c4bcf --- /dev/null +++ b/bin/extra/dbnewg @@ -0,0 +1,11 @@ +#!/bin/sh + +die () { >&2 printf '%s\n' "$@"; exit 1; } + +[ "$1" ] || die "usage: dbnewg <dir>" +proj="$(basename "$(readlink -f "$1")")" + +ssh git@db '$HOME/initdir.sh' "$proj" +cd "$1" || exit 1 +git remote add origin git@db:"$proj" +git push --set-upstream origin main diff --git a/bin/extra/ehbtodl b/bin/extra/ehbtodl index df11797..fc873f6 100755 --- a/bin/extra/ehbtodl +++ b/bin/extra/ehbtodl @@ -1,9 +1,13 @@  #!/usr/bin/env sh -echo "$1" | sed 's/-H/\\\n\t&/g' | sed '/gzip/d' > /tmp/curlcommand.sh  -sh /tmp/curlcommand.sh > /tmp/ehbso.html -vids="$(grep -oE "youtube\.com/embed/.{11}" /tmp/ehbso.html | cut -d'/' -f 3 | tr '\n' ' ')" +printf "%s\n" "$1" | +	sed 's/-H/\\\n&/g' | +	sed '/gzip/d' | +	tee /tmp/curlcommand.sh | +	sh > /tmp/ehbso.html +vids="$(grep -oE "youtube\.com/embed/.{11}" /tmp/ehbso.html | +	cut -d'/' -f 3 | +	tr '\n' ' ')"  for i in $vids  -do -	echo "https://www.youtube.com/watch?v=$i" +do printf "%s\n" "https://www.youtube.com/watch?v=$i"  done > /tmp/todownload  # yt-dlp -P "$HOME/Downloads/vids" -o "%(title)s" -a /tmp/todownload diff --git a/bin/extra/gml b/bin/extra/gml new file mode 100755 index 0000000..0f2f143 --- /dev/null +++ b/bin/extra/gml @@ -0,0 +1,70 @@ +#!/bin/sh + +minecraft() +{ +	instance="$( +	( +	printf "default\n" +	find ~/.local/share/multimc/instances \ +		-maxdepth 1 -mindepth 1 \ +		-type d \ +		-printf "%f\n" | +		grep -v '_LAUNCHER_TEMP' +			) | +				commander -d -c -x)" + +			[ "$instance" ] || exit 1 +			[ "$instance" = "default" ]  && instance="1.20.1" + +			ips="none 192.168.178.79 192.168.178.52 10.7.0.1 mc.hypixel.net" +			ip="$(for ip in $ips +		do printf "%s\n" "$ip" +		done | commander -d -c)" + +		if [ "$ip" != 'none' ]  +		then setsid multimc -l "$instance" -s "$ip" > /dev/null 2>&1 +		else  + +			world="$( +			( +			printf "none\n" +			find "$HOME"/.local/share/multimc/instances/"$instance"/.minecraft/saves/ \ +				-mindepth 1 -maxdepth 1 \ +				-type d \ +				-printf "%f\n" +							) | commander -d -c -s)" + +							[ -z "$world" ] && exit 1 + +							if [ "$world" = 'none' ] +							then setsid multimc -l "$instance" > /dev/null 2>&1 +							else setsid multimc -l "$instance" -w "$world" > /dev/null 2>&1 +							fi + +		fi +} + +steam() +{ +	choice="$( +	cat <<-EOF | column -t -l 2 | commander -d -x -c | awk '{printf $1}' +	274190 broforce +	291550 brawlhalla +	1712840 tiny tina +	105600 terraria +	kill +EOF +	)" +	case "$choice" in +		kill) pkill steam ;; +		*) setsid steam steam://rungameid/"$choice" ;; +	esac +	exit +} + +eval "$( +	cat <<-EOF | commander -c -w 9 -y 2 +	minecraft +	steam +	EOF +)" diff --git a/bin/extra/pomo b/bin/extra/pomo new file mode 100755 index 0000000..a2c371d --- /dev/null +++ b/bin/extra/pomo @@ -0,0 +1,31 @@ +#!/bin/sh +notif() { notify-send -t 1000 -w "pomo" "$1"; } + +for msg in "three" "two" "one" +do notif "$msg" +done + +# $1: time in minutes +# $2: msg for notification +ring_ring() +{ +	date '+%R B' +	notify-send -w "$(($1*1000*60))" -u critical "pomo" "$2" +} + +i="${1-0}" +while true + +do  +	notif "<b>START</b>" +	date '+%R S' +	sleep 20m +	if [ "$i" -eq 3 ] +	then +		i=0 +		ring_ring 20 "GIGA BREAK TIME" +	else +		ring_ring 5 "BREAK TIME" +		i=$((i+1)) +	fi +done diff --git a/bin/extra/supd b/bin/extra/supd index 931d808..4975b94 100755 --- a/bin/extra/supd +++ b/bin/extra/supd @@ -1,24 +1,44 @@  #!/bin/sh -print_dir () { printf '%s: ' "$1" | sed "s#$HOME#~#" >&2; } +usage() { +	>&2 cat <<-EOF +	usage: supd +	       supd <prefix> <dir> +		   stdout | supd <prefix> +	EOF +	exit 1 +}  check ()  {  	for dir in $1  	do -		print_dir "$2/$dir" +		printf '%s: ' "$2/$dir" | sed "s#$HOME#~#" >&2  		cd "$2/$dir" || continue  		git pull > /dev/null 2>&1 &&  			printf 'Up to date.' ||  			printf 'Couldn'\''t update.' -		printf '\n' +		printf ' ' +		printf '%s %s\n' "$(git status --short 2> /dev/null | +			awk 'NR==1 {print $1}')" "$(git branch -v 2>/dev/null | +			grep '^\*' | cut -f2 -d'[' | cut -f1 -d' ' | +			sed 's/ahead/↑/;s/behind/↓/;s/\*//')" +  	done  } -dirs="installdrier dotfiles password-store" -prefix="$HOME/src" +if [ "$#" -eq 0 ] +then +	dirs="installdrier dotfiles password-store" +	prefix="$HOME/src" +elif [ ! -t 0 ] +then +	prefix="$1" +	dirs="$(cat)" +else +	prefix="$1" +	shift || usage +	dirs="$*" +	[ "$dirs" ] || usage +fi  check "$dirs" "$prefix" - -# dirs="$(ls -1 "$HOME/proj/personal")" -# prefix="$HOME/proj/personal" -# check "$dirs" "$prefix" diff --git a/bin/guiscripts/fillpass b/bin/guiscripts/fillpass new file mode 100755 index 0000000..358afd1 --- /dev/null +++ b/bin/guiscripts/fillpass @@ -0,0 +1,15 @@ +#!/bin/sh + +pass="$( +	find "${PASSWORD_STORE_DIR:=~/src/password-store/}" -name "*.gpg" | +	sed -e "s@$PASSWORD_STORE_DIR/@@" -e 's/\.gpg$//' | +	commander -x -c)" +[ "$pass" ] || exit 1 + +login="$(pass show "$pass" | awk '/^login:/ {print $2}')" +password="$(pass show "$pass" | head -n 1)" + +if [ "$login" ] +then printf '%s\t%s\n' "$login" "$password" | ydotool type -f - +else printf '%s\n' "$password" | ydotool type -f - +fi diff --git a/bin/guiscripts/linkhandler b/bin/guiscripts/linkhandler index 084b952..aeec202 100755 --- a/bin/guiscripts/linkhandler +++ b/bin/guiscripts/linkhandler @@ -14,11 +14,14 @@ case "$url" in  	*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)  		setsid -f mpv --quiet --ytdl --ytdl-raw-options="format-sort=res:720" "$url" > /dev/null 2>&1 ;;  	*png|*jpg|*jpe|*jpeg|*gif) -		curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")"  >/dev/null 2>&1 & ;; +		curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && $IMAGE -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")"  >/dev/null 2>&1 & ;;  	*pdf|*cbz|*cbr) -		curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && evince "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")"  >/dev/null 2>&1 & ;; +		curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && $VIEWER "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")"  >/dev/null 2>&1 & ;;  	*mp3|*flac|*opus|*mp3?source*)  		qndl "$url" 'curl -LO'  >/dev/null 2>&1 ;;  	*) -		[ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1 +		if [ -f "$url" ] +		then setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 +		else setsid -f "$BROWSER" "$url" >/dev/null 2>&1 +		fi  esac diff --git a/bin/guiscripts/locker b/bin/guiscripts/locker index b680484..7c42cda 100755 --- a/bin/guiscripts/locker +++ b/bin/guiscripts/locker @@ -9,7 +9,7 @@ for monitor in $monitors  do  	file="/tmp/locker-$monitor.png"  	grim -l 0 -o "$monitor" "$file" -	pixelate "$file" "$file" +	pixelate "$file" "$file" > /dev/null 2>&1  	# Create image command for swaylock  	img_opt="--image $monitor:$file $img_opt"  	files="$files $file" diff --git a/bin/guiscripts/newwal b/bin/guiscripts/newwal index b913552..32d3db6 100755 --- a/bin/guiscripts/newwal +++ b/bin/guiscripts/newwal @@ -10,8 +10,8 @@ res="1920x1080"  # if no (valid) argument, use find any image with $res resolution  # and take a random one  test -f "${wal:=$(realpath "$1")}" || -	wal="$(find "$walls" -type f | -		xargs identify | +	wal="$(find "$walls" -type f -print0 | +		xargs -0 identify |  		grep "$res" |  		awk '{print $1}' |  		shuf -n 1)" diff --git a/bin/menuscripts/mpower b/bin/menuscripts/mpower index 3b66824..0d0cdcc 100755 --- a/bin/menuscripts/mpower +++ b/bin/menuscripts/mpower @@ -1,8 +1,11 @@  #!/bin/sh -choice="$(printf 'poweroff +choice="$( +cat <<EOF | commander -c -w 9 -y 4 +poweroff  suspend  hibernate  reboot -' | commander -c -d)" +EOF +)"  [ "$choice" ] && systemctl "$choice"  | 
