From 7b21727285e50b0b050c4ddd70d07542229c5366 Mon Sep 17 00:00:00 2001 From: pants Date: Mon, 21 Sep 2026 14:17:03 -0700 Subject: init --- bin/audioswitch | 14 ++++++++++++++ bin/autoclick | 2 ++ bin/bgselect | 2 ++ bin/brightness | 12 ++++++++++++ bin/browser | 2 ++ bin/calculator | 8 ++++++++ bin/cpuctl | 31 +++++++++++++++++++++++++++++++ bin/displayctl | 36 ++++++++++++++++++++++++++++++++++++ bin/espdev | 27 +++++++++++++++++++++++++++ bin/gsr | 24 ++++++++++++++++++++++++ bin/manager | 24 ++++++++++++++++++++++++ bin/mpd-monitor | 30 ++++++++++++++++++++++++++++++ bin/multi_unzip | 13 +++++++++++++ bin/open | 8 ++++++++ bin/playerctl-mon | 8 ++++++++ bin/power_mode | 11 +++++++++++ bin/pull_all | 12 ++++++++++++ bin/record | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ bin/screenshot | 10 ++++++++++ bin/st-cpu | 25 +++++++++++++++++++++++++ bin/st-disk | 2 ++ bin/st-mem | 18 ++++++++++++++++++ bin/st-power | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/st-rec | 8 ++++++++ bin/st-temp | 18 ++++++++++++++++++ bin/st-usage | 4 ++++ bin/st-vol | 10 ++++++++++ bin/sync_music | 7 +++++++ bin/tc | 39 +++++++++++++++++++++++++++++++++++++++ bin/volumectl | 26 ++++++++++++++++++++++++++ 30 files changed, 535 insertions(+) create mode 100755 bin/audioswitch create mode 100755 bin/autoclick create mode 100755 bin/bgselect create mode 100755 bin/brightness create mode 100755 bin/browser create mode 100755 bin/calculator create mode 100755 bin/cpuctl create mode 100755 bin/displayctl create mode 100755 bin/espdev create mode 100755 bin/gsr create mode 100755 bin/manager create mode 100755 bin/mpd-monitor create mode 100755 bin/multi_unzip create mode 100755 bin/open create mode 100755 bin/playerctl-mon create mode 100755 bin/power_mode create mode 100755 bin/pull_all create mode 100755 bin/record create mode 100755 bin/screenshot create mode 100755 bin/st-cpu create mode 100755 bin/st-disk create mode 100755 bin/st-mem create mode 100755 bin/st-power create mode 100755 bin/st-rec create mode 100755 bin/st-temp create mode 100755 bin/st-usage create mode 100755 bin/st-vol create mode 100755 bin/sync_music create mode 100755 bin/tc create mode 100755 bin/volumectl (limited to 'bin') diff --git a/bin/audioswitch b/bin/audioswitch new file mode 100755 index 0000000..8b910c1 --- /dev/null +++ b/bin/audioswitch @@ -0,0 +1,14 @@ +#!/bin/sh +CARD=$(pactl list cards short | grep '1f.3' | awk '{print $2}') +CURRENT_SINK=$(pactl info | grep "Default Sink:") +dunstctl close-all +case $CURRENT_SINK in + *iec958*) + pactl set-card-profile $CARD output:analog-stereo + notify-send "analog out active" -i : + ;; + *) + pactl set-card-profile $CARD output:iec958-stereo + notify-send "digital out active" -i : + ;; +esac diff --git a/bin/autoclick b/bin/autoclick new file mode 100755 index 0000000..65cb627 --- /dev/null +++ b/bin/autoclick @@ -0,0 +1,2 @@ +#!/bin/sh +xdotool click --repeat 32 --delay 50 1 diff --git a/bin/bgselect b/bin/bgselect new file mode 100755 index 0000000..ca955ed --- /dev/null +++ b/bin/bgselect @@ -0,0 +1,2 @@ +#!/bin/sh +SELECTION=$(ls ~/repos/bag/ | dmenu -c -i -l 10 ) && feh --no-fehbg --bg-fill ~/repos/bag/$SELECTION diff --git a/bin/brightness b/bin/brightness new file mode 100755 index 0000000..fb21f26 --- /dev/null +++ b/bin/brightness @@ -0,0 +1,12 @@ +#!/bin/sh +dunstctl close-all +case "$1" in + "up") + brightnessctl set "$2"%+;; + "down") + brightnessctl set "$2"%-;; +esac +CURRENT=$(brightnessctl get) +MAX=$(brightnessctl max) +BRIGHTNESS=$(echo "scale=2; ("$CURRENT"/"$MAX")*100" | bc | sed s/\.00$//g) +notify-send "Brightness set to "$BRIGHTNESS%"" -i : diff --git a/bin/browser b/bin/browser new file mode 100755 index 0000000..eb89c66 --- /dev/null +++ b/bin/browser @@ -0,0 +1,2 @@ +#!/bin/sh +firefox& diff --git a/bin/calculator b/bin/calculator new file mode 100755 index 0000000..d8257cf --- /dev/null +++ b/bin/calculator @@ -0,0 +1,8 @@ +#!/bin/sh +#EXPRESSION=$(printf "" | dmenu -b -w $(xdotool getactivewindow) -p "calculator") +#RESULT=$(qalc $EXPRESSION) +#printf "" | dmenu -b -w $(xdotool getactivewindow) -p "$RESULT" +#echo $RESULT | sed 's/^[^=≈]*[=≈]//' | xclip -selection clipboard + +# start qalc in terminal instead +st -i -g 60x20-100+100 -e qalc diff --git a/bin/cpuctl b/bin/cpuctl new file mode 100755 index 0000000..d2c2b57 --- /dev/null +++ b/bin/cpuctl @@ -0,0 +1,31 @@ +#!/bin/sh +MIN_FREQUENCY=$(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_min_freq) +MAX_FREQUENCY=$(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq) +SCALING_MAX=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq) +SCALING_MIN=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq) +GOVERNOR=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor) + +if [ "$1" = "get" ]; then + echo "Minimum / Maximum Frequencies: $SCALING_MIN / $SCALING_MAX" + echo "Governor: $GOVERNOR" +elif [ "$1" = "set" ]; then + case "$2" in + "") + echo "Set what? Nothing was changed, exiting...";; + "defaults") + echo "$MIN_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_min_freq + echo "$MAX_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_max_freq;; + "minfreq") + echo "$MIN_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_max_freq + echo "$MIN_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_min_freq;; + "maxfreq") + echo "$MAX_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_min_freq + echo "$MAX_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_max_freq;; + "ondemand") + echo "ondemand" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_governor;; + "schedutil") + echo "schedutil" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_governor;; + "performance") + echo "performance" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_governor;; + esac +fi diff --git a/bin/displayctl b/bin/displayctl new file mode 100755 index 0000000..85c6c7b --- /dev/null +++ b/bin/displayctl @@ -0,0 +1,36 @@ +#!/bin/sh + +# unused for now, repurposing for ddcutil control +## back in use! + +CHOICE=$(printf "brightness\ncontrast\ntoggle secondary display" | dmenu -c -i -l 3) +DISPLAY_STATUS=$(xrandr | grep DisplayPort-0) +MONITORS="1 2" + +toggle() { + case $DISPLAY_STATUS in + *3440x1440*) + xrandr --output DisplayPort-0 --off;; + *) + init_displays;; + esac +} + +get_value() { + VALUE=$(printf "0\n10\n20\n30\n40\n50\n60\n70\n80\n90\n100" | dmenu -c -i -p "value to set") +} + +case $CHOICE in + "brightness") + get_value + for monitor in $MONITORS; do + ddcutil -d $monitor setvcp 10 $VALUE + done;; + "contrast") + get_value + for monitor in $MONITORS; do + ddcutil -d $monitor setvcp 12 $VALUE + done;; + "toggle secondary display") + toggle;; +esac diff --git a/bin/espdev b/bin/espdev new file mode 100755 index 0000000..b19b72b --- /dev/null +++ b/bin/espdev @@ -0,0 +1,27 @@ +#!/bin/sh + +if [ $1 = "source" ]; then + echo "sourcing and exiting..." +. $HOME/esp/esp-idf/export.sh + exit +fi + +. $HOME/esp/esp-idf/export.sh +echo "cleaning up..." +idf.py fullclean +echo "done cleaning." +echo "building..." +idf.py build +echo "done building." +echo "flashing..." +idf.py -p /dev/ttyACM0 flash +echo "done flashing." +read -n 1 input -p "monitor serial output? [y/n]" +if [ $input = y ]; then + echo "monitoring..." + idf.py -p /dev/ttyACM0 monitor +else if [ $input = n ]; then + exit +else + echo "yes or no dude..." +fi diff --git a/bin/gsr b/bin/gsr new file mode 100755 index 0000000..1dc50d7 --- /dev/null +++ b/bin/gsr @@ -0,0 +1,24 @@ +#!/bin/sh +GSRPID=$(pidof gpu-screen-recorder) +DWMBLOCKSPID=$(pidof dwmblocks) +AUDIO="-ac opus -a default_output|default_input" +AUDIONOMIC="-ac opus -a default_output" +VIDEO="-w DP-3 -k av1_10bit -c mkv -fm content -bm vbr" +OUTPUT="-o $HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv" + +if [ -n "$GSRPID" ]; then + kill -SIGINT $GSRPID + kill -RTMIN+2 $DWMBLOCKSPID + notify-send "recording saved" -i : + exit +fi + +if [ $1 = 1 ]; then + gpu-screen-recorder $VIDEO $AUDIONOMIC $OUTPUT& + kill -RTMIN+2 $DWMBLOCKSPID + notify-send "recording started with no mic" -i : +else + gpu-screen-recorder $VIDEO $AUDIO $OUTPUT& + kill -RTMIN+2 $DWMBLOCKSPID + notify-send "recording started" -i : +fi diff --git a/bin/manager b/bin/manager new file mode 100755 index 0000000..9801d75 --- /dev/null +++ b/bin/manager @@ -0,0 +1,24 @@ +#!/bin/sh +CORE="suspend\nreboot\nhibernate\nshutdown\nkey repeat rate\nvolume mixer" +#EXTRA="display settings\nrgb off" + +ACTION=$(printf "$CORE\n$EXTRA" | dmenu -c -i -l 10 -p "manager") + +case "$ACTION" in + "suspend") + loginctl suspend;; + "reboot") + loginctl reboot;; + "hibernate") + loginctl hibernate;; + "shutdown") + loginctl poweroff;; + "key repeat rate") + xset r rate 200 40;; + "volume mixer") + st -i -g 80x20-200+200 -e pulsemixer;; + "rgb off") + openrgb --mode direct --color 000000;; + "display settings") + displayctl;; +esac diff --git a/bin/mpd-monitor b/bin/mpd-monitor new file mode 100755 index 0000000..009c984 --- /dev/null +++ b/bin/mpd-monitor @@ -0,0 +1,30 @@ +#!/bin/sh + +PID=$(pgrep -x mpc) +if [ -n "$PID" ]; then + echo "another instance of mpd-monitor already running" + exit +fi + +ID=$(mpc current -f %id% ) +mpc idleloop | + while read -r event; do + # if a player event is not output, skip rest of loop + [ "$event" = "player" ] || continue + + # get current id to compare to init id + NEW_ID=$(mpc current -f %id%) + # if a player event is output, but the track has not changed, skip rest of loop + [ "$NEW_ID" != "$ID" ] || continue + ID=$NEW_ID + + dunstctl close-all + TITLE=$(mpc current -f %title%) + ARTIST=$(mpc current -f %artist%) + + if [ -z "$TITLE" ]; then + notify-send "End of queue or queue empty" "or no metadata for track" -i : + else + notify-send "$TITLE" "$ARTIST" -i : + fi + done diff --git a/bin/multi_unzip b/bin/multi_unzip new file mode 100755 index 0000000..94ecd3f --- /dev/null +++ b/bin/multi_unzip @@ -0,0 +1,13 @@ +#!/bin/sh + +# unzips the contents of every present zip archive into directories of the same name +# the % is used to remove the file extension (.zip). +# % matches the shortest occurence from the end. +# %% would remove all extensions (.tar.gz would be matched by %%) +# # and ## are the corresponding operators for matching at the beginning + +for file in ./*.zip; do + dir_name=${file%.*} + mkdir -p "$dir_name" + unzip -d "$dir_name" "$file" +done diff --git a/bin/open b/bin/open new file mode 100755 index 0000000..f6991e0 --- /dev/null +++ b/bin/open @@ -0,0 +1,8 @@ +#!/bin/sh +FILE=$(find -maxdepth 5 -type f | dmenu -c -i -l 10 -p "path to open") + +if ( ./"$FILE" ); then + exit +else + xdg-open "$FILE" +fi diff --git a/bin/playerctl-mon b/bin/playerctl-mon new file mode 100755 index 0000000..9d02d80 --- /dev/null +++ b/bin/playerctl-mon @@ -0,0 +1,8 @@ +#!/bin/sh +playerctl --follow metadata title | + while read x; do + dunstctl close-all + TITLE=$(playerctl metadata title) + ARTIST=$(playerctl metadata artist) + notify-send "$TITLE" "$ARTIST" -i : + done diff --git a/bin/power_mode b/bin/power_mode new file mode 100755 index 0000000..eade12d --- /dev/null +++ b/bin/power_mode @@ -0,0 +1,11 @@ +#!/bin/sh +CURRENT_POWER_MODE=$(powerprofilesctl get) +CHOICE=$(printf "performance\nbalanced\npower-saver" | dmenu -c -i -l 5 -p "$CURRENT_POWER_MODE") +case "$CHOICE" in + "performance") + powerprofilesctl set performance;; + "balanced") + powerprofilesctl set balanced;; + "power-saver") + powerprofilesctl set power-saver;; +esac diff --git a/bin/pull_all b/bin/pull_all new file mode 100755 index 0000000..662d792 --- /dev/null +++ b/bin/pull_all @@ -0,0 +1,12 @@ +#!/bin/sh +for repo in ./*/; do + ( + cd "$repo" || exit + git pull + cd - + ) > /dev/null 2<&1 & +done + +wait + +echo "done" diff --git a/bin/record b/bin/record new file mode 100755 index 0000000..03737ef --- /dev/null +++ b/bin/record @@ -0,0 +1,50 @@ +#!/bin/sh + +#PID=$(pidof ffmpeg) +#if [ -n "$PID" ]; then +# pkill -SIGINT ffmpeg +# pkill -SIGRTMIN+2 dwmblocks +# notify-send "recording saved" -i : +# exit +#fi +# +#SCREEN="ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -s 3440x1440 -f x11grab -r 60 -i :0.0+0,0 " +#SYSTEM_AUDIO="-f pulse -i alsa_output.pci-0000_00_1f.3.iec958-stereo.monitor" +#MICROPHONE="-f pulse -i default:monitor" +#COMPRESSION="-c:a flac -vf format=nv12,hwupload -c:v av1_vaapi" +#FILENAME="$HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv" +#SIGSEND="pkill -SIGRTMIN+2 dwmblocks" +# +#if [ $1 = 1 ]; then +# $SCREEN $SYSTEM_AUDIO $COMPRESSION $FILENAME& +# notify-send "recording started with no mic" -i : +#else +# $SCREEN $SYSTEM_AUDIO $MICROPHONE -filter_complex "[1:0][2:0]amerge=inputs=2[a]" -map 0:v -map "[a]" $COMPRESSION $FILENAME& +# notify-send "recording started" -i : +#fi +# +#$SIGSEND + +# gpu-screen-recorder +GSRPID=$(pidof gpu-screen-recorder) +AUDIO="-ac opus -a default_output|default_input" +AUDIONOMIC="-ac opus -a default_output" +VIDEO="-w DisplayPort-1 -k av1 -c mkv -fm content -bm vbr" +OUTPUT="-o $HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv" + +if [ -n "$GSRPID" ]; then + pkill -SIGINT -f gpu-screen-recorder + pkill -SIGRTMIN+2 dwmblocks + notify-send "recording saved" -i : + exit +fi + +if [ $1 = 1 ]; then + gpu-screen-recorder $VIDEO $AUDIONOMIC $OUTPUT& + notify-send "recording started with no mic" -i : +else + gpu-screen-recorder $VIDEO $AUDIO $OUTPUT& + notify-send "recording started" -i : +fi + +pkill -SIGRTMIN+2 dwmblocks diff --git a/bin/screenshot b/bin/screenshot new file mode 100755 index 0000000..394e02c --- /dev/null +++ b/bin/screenshot @@ -0,0 +1,10 @@ +#!/bin/sh +FILENAME=$(date +%m-%d-%Y_%R:%S) +mkdir -p ~/pictures/screenshots +if [ $1 = 1 ]; then + import clipboard: + notify-send "Screenshot taken" "copied to clipboard" -i : +else + import -window root ~/pictures/screenshots/"$FILENAME".png + notify-send "Screenshot taken" "saved to ~/pictures/screenshots/$FILENAME.png" -i : +fi diff --git a/bin/st-cpu b/bin/st-cpu new file mode 100755 index 0000000..3d4e463 --- /dev/null +++ b/bin/st-cpu @@ -0,0 +1,25 @@ +#!/bin/sh +CPUTEMP=$(sensors | grep "Package id 0" | awk '{print $4}' | sed 's/+//;s/\.0//g' ) +#CPUFREQ=$(cat /sys/devices/system/cpu/cpufreq/policy1/scaling_cur_freq) +# +#if [ $CPUFREQ -gt 1000000 ]; then +# CPUFREQ="$(echo "scale=1; $CPUFREQ / 1000000" | bc) GHz" +#else +# CPUFREQ="$(echo "scale=0; $CPUFREQ / 1000" | bc) MHz" +#fi + +# freebsd +#CORETEMPS=$(sysctl dev.cpu | grep temperature | awk '{print $2}' | sed s/.[0-9]C$//g) +# +#CORE_COUNT=0 +#SUM=0 +# +#for temp in $CORETEMPS; do +# SUM=$((SUM + temp)) +# CORE_COUNT=$((CORE_COUNT + 1)) +#done +# +# +#CPUTEMP="$((SUM / CORE_COUNT)) C" + +echo $CPUTEMP diff --git a/bin/st-disk b/bin/st-disk new file mode 100755 index 0000000..f3338ef --- /dev/null +++ b/bin/st-disk @@ -0,0 +1,2 @@ +#!/bin/sh +echo $(df / | awk 'NR==2 {print $6" "$5}') diff --git a/bin/st-mem b/bin/st-mem new file mode 100755 index 0000000..8e0a7df --- /dev/null +++ b/bin/st-mem @@ -0,0 +1,18 @@ +#!/bin/sh +MEMORY_USED=$(free -h | awk 'NR==2 {print $3}') + +# freebsd (and maybe better for linux too) +#PAGES_WIRED=$(sysctl vm.stats.vm.v_wire_count | awk '{print $2}') +#PAGES_ACTIVE=$(sysctl vm.stats.vm.v_active_count | awk '{print $2}') +#PAGES_DIRTY=$(sysctl vm.stats.vm.v_laundry_count | awk '{print $2}') +#TOTAL_PAGES=$(echo "scale=0; $PAGES_WIRED+$PAGES_ACTIVE+$PAGES_DIRTY" | bc) +# +#BYTES_USED=$(echo "scale=0; $TOTAL_PAGES*4096" | bc) +# +#if [ $BYTES_USED -ge 1073741824 ]; then +# MEMORY_USED="$(echo "scale=1; $BYTES_USED/1024^3" | bc) GiB" +#else +# MEMORY_USED="$(echo "scale=1; $BYTES_USED/1024^2" | bc) MiB" +#fi + +echo $MEMORY_USED diff --git a/bin/st-power b/bin/st-power new file mode 100755 index 0000000..e3fe69a --- /dev/null +++ b/bin/st-power @@ -0,0 +1,54 @@ +#!/bin/sh + +# for UPS monitoring with NUT +# +#DATA_CMD="upsc ups@localhost" + +# on debian and freebsd, ups.realpower is not available. +# calculate load in watts with load percent and max output instead. +#MAX_OUTPUT=$($DATA_CMD | grep ups.realpower.nominal: | awk '{print $2}') +#LOAD_VALUE=$($DATA_CMD | grep ups.load: | awk '{print $2}') +#LOAD_PERCENT=$(echo "scale=2; $LOAD_VALUE/100" | bc) +#POWER=$(echo "scale=0; $LOAD_PERCENT*$MAX_OUTPUT" | bc) + +# on void, ups.realpower is available! +#POWER="$($DATA_CMD | grep ups.realpower: | awk '{print $2}') W" + +# "round" to integer. just removes decimal and whatevers after. not necessary with ups.realpower. +#POWER="${POWER%.*} W" +#CHARGE="$($DATA_CMD | grep battery.charge: | awk '{print $2}')%" + +#if [ "$CHARGE" = "100%" ]; then +# echo $POWER +#else +# echo "$CHARGE $POWER" +#fi + +# for battery monitoring everywhere else +# +# if power_now is present, just divide it to watts. +# (from micro watts on thinkpads, perhaps something else on other platforms) +if test -f /sys/class/power_supply/BAT*/power_now; then + POWER=$(cat /sys/class/power_supply/BAT*/power_now) + POWER="$(echo "scale=2; $POWER/1000000" | bc)W" +else +# if power_now is not present, calculate it: + VOLTAGE=$(cat /sys/class/power_supply/BAT*/voltage_now) + CURRENT=$(cat /sys/class/power_supply/BAT*/current_now) + POWER="$(echo "scale=2; $VOLTAGE*$CURRENT/1000000000000" | bc)W" +fi + +STATUS=$(cat /sys/class/power_supply/BAT*/status) + +#case "$STATUS" in +# "Charging") +# STATUS="+";; +# "Discharging") +# STATUS="-";; +# "Not Charging") +# STATUS="...";; +#esac + +CHARGE="$(cat /sys/class/power_supply/BAT*/capacity)%" + +echo "$CHARGE $POWER $STATUS" diff --git a/bin/st-rec b/bin/st-rec new file mode 100755 index 0000000..a620002 --- /dev/null +++ b/bin/st-rec @@ -0,0 +1,8 @@ +#!/bin/sh +sleep 0.5 +PID=$(pidof gpu-screen-recorder) +if [ -n "$PID" ]; then + echo " REC" +#elif [ -z "$PID" ]; then +# echo " - " +fi diff --git a/bin/st-temp b/bin/st-temp new file mode 100755 index 0000000..20d7a01 --- /dev/null +++ b/bin/st-temp @@ -0,0 +1,18 @@ +#!/bin/sh +CPUTEMP=$(sensors | grep "Package id 0" | awk '{print $4}' | sed 's/+//;s/\.0//g' ) + +# freebsd +#CORETEMPS=$(sysctl dev.cpu | grep temperature | awk '{print $2}' | sed s/.[0-9]C$//g) +# +#CORE_COUNT=0 +#SUM=0 +# +#for temp in $CORETEMPS; do +# SUM=$((SUM + temp)) +# CORE_COUNT=$((CORE_COUNT + 1)) +#done +# +# +#CPUTEMP="$((SUM / CORE_COUNT)) C" + +echo $CPUTEMP diff --git a/bin/st-usage b/bin/st-usage new file mode 100755 index 0000000..c49a20f --- /dev/null +++ b/bin/st-usage @@ -0,0 +1,4 @@ +#!/bin/sh +CPU_USAGE=$(top -bn2 | grep "%Cpu(s)" | awk 'NR==2 {print 100 - $8}') +GPU_USAGE=$(nvtop -s | grep gpu_util | awk '{print $2}' | sed 's/"//g;s/,//') +echo "CPU:$CPU_USAGE% GPU:$GPU_USAGE" diff --git a/bin/st-vol b/bin/st-vol new file mode 100755 index 0000000..970bd68 --- /dev/null +++ b/bin/st-vol @@ -0,0 +1,10 @@ +#!/bin/sh +VOLUME=$(wpctl get-volume @DEFAULT_SINK@) +#VOLUME=$(mixer | grep vol) +case $VOLUME in + *MUTED*) + echo " MUTED";; +esac +#VOLUME=$(echo $VOLUME | awk '{print $3}' | sed 's/:.*//;s/^0//;s/\.//') +VOLUME=$(echo $VOLUME | awk '{print $2}' | sed s/^0\.//g) +echo " $VOLUME" diff --git a/bin/sync_music b/bin/sync_music new file mode 100755 index 0000000..11fa799 --- /dev/null +++ b/bin/sync_music @@ -0,0 +1,7 @@ +#!/bin/sh +rsync -aP $HOME/wdraidz/media/music/ $HOME/music/ > $HOME/.sync_log && SUCCESS=1 +if [ $SUCCESS = 1 ]; then + notify-send "sync complete; logged to $HOME/.sync_log" -i : +else + notify-send "sync error..." -i : +fi diff --git a/bin/tc b/bin/tc new file mode 100755 index 0000000..bf013eb --- /dev/null +++ b/bin/tc @@ -0,0 +1,39 @@ +#!/bin/sh +for dir in ./*; do + cd "$dir" + mkdir -p output + for file in *.*; do + STRIPPED_NAME=${file%.*} + + # CPU + + ffmpeg -n -i "$file" \ + -init_hw_device vulkan=vk:0 \ + -c:a copy -c:v libsvtav1 -crf "$CRF" -preset "$PRESET" \ + -svtav1-params "tune=0:lookahead=120:scm=1" \ + output/"$STRIPPED_NAME".mkv + + # -init_hw_device vulkan=vk:0 + # platform-agnostic hardware accelerated decoding with vulkan + # only available for h264,h265, and experimentally av1 + + # parameters + ## temporal filtering: averages frames + # enable-tf=0 + ## screen content mode: optimization for screen captures (goated?) + # scm=1 + + # 10 bit color + #-pix_fmt yuv420p10le \ + + # VAAPI + #ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi \ + #-i "$file" -c:a copy -c:v av1_vaapi -crf 20 -b:v 30M "output/$file" + #ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi \ + #-i "$file" -c:a copy -c:v av1_vaapi -rc_mode VBR -b:v 30M -maxrate 35M "output/$file" + # NVENC + #ffmpeg -i "$file" \ + #-c:a copy -c:v hevc_nvenc -preset p7 -rc vbr -maxrate 1M output/"$file".mkv + done + cd .. +done diff --git a/bin/volumectl b/bin/volumectl new file mode 100755 index 0000000..e48a228 --- /dev/null +++ b/bin/volumectl @@ -0,0 +1,26 @@ +#!/bin/sh +INCREMENT="2" + +case $1 in + "up") + wpctl set-volume @DEFAULT_SINK@ $INCREMENT%+;; + "down") + wpctl set-volume @DEFAULT_SINK@ $INCREMENT%-;; + "mute") + wpctl set-mute @DEFAULT_SINK@ toggle;; +esac + +kill -RTMIN+1 $(pidof dwmblocks) + +# freebsd +#case $1 in +# "up") +# mixer vol.volume=+$INCREMENT% > /dev/null;; +# "down") +# mixer vol.volume=-$INCREMENT% > /dev/null;; +# "mute") +# mixer vol.mute=toggle > /dev/null;; +#esac +# +#PID=$(pgrep dwmblocks) +#kill -RTMIN+1 $PID -- cgit v1.2.3