This commit is contained in:
2025-07-02 00:07:49 -07:00
commit c208c6b35d
114 changed files with 71862 additions and 0 deletions

10
bin/audioswitch Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
CARD=$(pactl list cards short | grep '1f.3' | awk '{print $2}')
CURRENT_SINK=$(pactl info | grep "Default Sink:")
if [[ "$CURRENT_SINK" == *"iec958"* ]]; then
pactl set-card-profile $CARD output:analog-stereo
notify-send "analog out active" -i :
else
pactl set-card-profile $CARD output:iec958-stereo
notify-send "digital out active" -i :
fi

2
bin/autoclick Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
xdotool click --repeat 32 --delay 50 1

13
bin/backup Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
echo "backup starting at $(date)"
echo "backing up music and tank to toshiba_mirror"
rsync -aP /wdraidz/media/music/ /toshiba-mirror/backups/media/music/ >> /var/log/rsync.log
echo "music up to date..."
rsync -aP /wdraidz/tank/ /toshiba-mirror/backups/tank/ >> /var/log/rsync.log
echo "tank up to date..."
echo "backing up wdraidz to seastripe"
rsync -aP /wdraidz/media/ /seastripe/backups/wdraidz/media/ >> /var/log/rsync.log
echo "media to seastripe done"
rsync -aP /wdraidz/tank/ /seastripe/backups/wdraidz/tank/ >> /var/log/rsync.log
echo "tank to seastripe done"
echo "done."

2
bin/bgselect Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
feh --no-fehbg --bg-fill ~/.images/$(ls ~/.images/ | dmenu -c -l 10)

4
bin/bgshuffle Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
while true; do
feh --no-fehbg --bg-fill ~/.images/$(ls ~/.images | shuf -n 1)
done

2
bin/browser Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
chromium

5
bin/calculator Executable file
View File

@ -0,0 +1,5 @@
#!/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

8
bin/displayctl Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
DISPLAY_STATUS=$(xrandr | grep DP-4)
if [[ "$DISPLAY_STATUS" == *"1440x3440"* ]]; then
xrandr --output DP-4 --off
else
init_displays
fi

22
bin/gsr Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
GSRPID=$(pidof gpu-screen-recorder)
DWMBLOCKSPID=$(pidof dwmblocks)
if [[ -n $GSRPID ]]; then
kill -n 2 $GSRPID
kill -n 36 $DWMBLOCKSPID
notify-send "recording saved" -i :
exit
fi
if [[ $1 == 1 ]]; then
gpu-screen-recorder -w DP-0 -k hevc -c mkv -f 60 -bm cbr -q 12000 -ac opus -a "default_output" \
-o "$HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv"&
kill -n 36 $DWMBLOCKSPID
notify-send "recording started with no mic" -i :
else
gpu-screen-recorder -w DP-0 -k hevc -c mkv -f 60 -bm cbr -q 12000 -ac opus -a "default_output|default_input" \
-o "$HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv"&
kill -n 36 $DWMBLOCKSPID
notify-send "recording started" -i :
fi

10
bin/int_display_refresh-rate Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
LOW="xrandr --output eDP-1 --mode 2560x1600 --rate 60"
HIGH="xrandr --output eDP-1 --mode 2560x1600 --rate 165"
CHOICE=$(printf "165Hz\n60Hz" | dmenu -c -i -l 2 -p "choose refresh rate:")
case $CHOICE in
"165Hz")
$HIGH;;
"60Hz")
$LOW;;
esac

26
bin/manager Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
CORE="suspend\nsuspend in 5 minutes\nreboot\nshutdown\n"
EXTRA="sync music\nAIO pump speed\nkey repeat rate\nfan curve\nvolume mixer"
ACTION=$(printf "$CORE$EXTRA" | dmenu -c -i -l 10 -p "manager")
case "$ACTION" in
"suspend")
systemctl suspend;;
"suspend in 5 minutes")
sleep 300;systemctl suspend;;
"reboot")
systemctl reboot;;
"shutdown")
systemctl poweroff;;
"fan curve")
liquidctl_fan-curve;;
"key repeat rate")
xset r rate 200 40;;
"AIO pump speed")
set_pump_speed;;
"volume mixer")
st -i -g 60x20-200+200 -e pulsemixer;;
"sync music")
sync_music;;
esac

5
bin/multi_unzip Executable file
View File

@ -0,0 +1,5 @@
for file in ./*.zip; do
dir_name=${file%.*}
mkdir -p "$dir_name"
unzip -d "$dir_name" "$file"
done

77
bin/nmap Executable file
View File

@ -0,0 +1,77 @@
#!/bin/bash
# (c) CompuMatter, LLC, ServerMatter
# no warranty expressed or implied - use as is.
# purpose of this script:
# Can't use angryipscanner from a command line and haven't been able to find anything else that gives you what you're looking for?
# This nmap based bash script might just be what you're looking for.
if ! which nmap >/dev/null; then
echo "nmap is not installed - this script requires it"
echo "It can be installed with - apt install nmap"
return;
fi
# Check if the script is being run as root (EUID = 0)
if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root user or with sudo"
return;
fi
lease_file_location="/var/lib/dhcp/dhcpd.leases"
# will return br0, eth0, eno1 or whatever the default Interface is
default_interface=$(ip route | awk '/default/ {print $5}')
ip_and_cidr=$(ip -o -f inet addr show $default_interface | awk '{print $4}')
ip_range=$(echo $ip_and_cidr | sed 's/\.[0-9]*\//.0\//')
echo -e "\nRunning nmap -sn $ip_range to get a list of all IP addresses\n"
readarray -t ips < <(nmap -sn $ip_range | awk '/Nmap scan report/{gsub(/[()]/,""); print $NF}' | sort -t . -n -k 1,1 -k 2,2 -k 3,3 -k 4,4)
# Set column widths
col1=14
col2=17
col3=17
col4=15
col5=30
echo -e "Checking each IP address for Hostname, MAC, Workgroup or Domain, Manufacturer info\n"
# Format the output
printf "%-${col1}s | %-${col2}s | %-${col3}s | %-${col4}s | %-${col5}s \n" "IP" "MAC" "HOSTNAME" "WG-DOMAIN" "MANUFACTURER"
printf "%-${col1}s | %-${col2}s | %-${col3}s | %-${col4}s | %-${col5}s \n" "$(printf '%.s-' {1..13})" "$(printf '%.s-' {1..17})" "$(printf '%.s-' {1..17})" "$(printf '%.s-' {1..15})" "$(printf '%.s-' {1..30})"
for IP in "${ips[@]}"
do
# Run the nmap command for the current IP
OUTPUT="$(nmap --script nbstat.nse -p 137,139 $IP)"
# Extract the necessary information
MAC=$(echo "$OUTPUT" | grep 'MAC Address' | awk '{print $3}')
HOSTNAME=$(echo "$OUTPUT" | grep '<20>.*<unique>.*<active>' | awk -F'[|<]' '{print $2}' | tr -d '_' | xargs)
WG_DOMAIN=$(echo "$OUTPUT" | grep -v '<permanent>' | grep '<00>.*<group>.*<active>' | awk -F'[|<]' '{print $2}' | tr -d '_' | xargs)
MANUFACTURER=$(echo "$OUTPUT" | grep 'MAC Address' | awk -F'(' '{print $2}' | cut -d ')' -f1)
# if a dhcp server leases file exists on this machine, we will query it for a hostname if not already returned by nmap
if [ -f "$lease_file_location" ]; then
# If HOSTNAME is empty, fetch from dhcpd.leases
if [ -z "$HOSTNAME" ]; then
HOSTNAME=$(awk -v ip="$IP" '$1 == "lease" && $2 == ip {f=1} f && /client-hostname/ {print substr($2, 2, length($2) - 3); exit}' "$lease_file_location" | cut -c 1-15)
# Append an asterisk (*) if HOSTNAME has a value
if [ -n "$HOSTNAME" ]; then
HOSTNAME="$HOSTNAME *"
fi
fi
fi
# Print a row of data for the current IP
printf "%-${col1}s | %-${col2}s | %-${col3}s | %-${col4}s | %-${col5}s \n" "$IP" "$MAC" "$HOSTNAME" "$WG_DOMAIN" "$MANUFACTURER"
done
if [ -f "$lease_file_location" ]; then
echo -e "\n* to the right of hostname indicates the hostname could not be acquired from nmap so was pulled from $lease_file_location\n"
fi
# we are grateful if you would leave our short tagline attached
echo -e "This network scanner script is provided free of charge by ServerMatter\n"
# Disclaimer: This script is provided as-is with no warranty and no responsibility.
# The author and contributors shall not be liable for any direct, indirect, incidental,
# special, exemplary, or consequential damages arising from the use of this script.

4
bin/open Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
DIR=$(ls $HOME | dmenu -c -i -l 10 -p "choose dir")
FILE=$(ls $HOME/$DIR| dmenu -c -i -l 10 -p "file to open")
xdg-open $HOME/$DIR/"$FILE"

8
bin/playerctl-mon Executable file
View File

@ -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

12
bin/pull_all Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
for repo in ./*/; do
(
cd "$repo" || exit
git pull
cd -
) > /dev/null 2<&1 &
done
wait
echo "done"

15
bin/record Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
SCREEN="ffmpeg -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 -c:v hevc_nvenc -b:v 12M"
FILENAME="$HOME/wdraidz/media/game-videos/$(date +%m-%d-%Y_%R:%S).mkv"
SIGSEND="kill -n 36 $(pidof dwmblocks)"
if [[ $1 == 1 ]]; then
$SCREEN $SYSTEM_AUDIO $MICROPHONE -filter_complex "[1:0][2:0]amerge=inputs=2[a]" -map 0:v -map "[a]" $COMPRESSION $FILENAME&
else
$SCREEN $SYSTEM_AUDIO $COMPRESSION $FILENAME&
fi
$SIGSEND

9
bin/run Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
mkdir -p "output"
TRACK=1
for file in *.opus; do
NEW_FILENAME=$(echo $file | sed 's/ - Kirby Super Star OST//')
TITLE=$(echo $file | sed 's/ - Kirby Super Star OST.opus//')
ffmpeg -i "$file" -metadata artist="Nintendo" -metadata album="Kirby Super Star OST" -metadata title="$TITLE" -metadata track="$TRACK" -codec copy "output/$file"
((TRACK++))
done

7
bin/screenshot Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
if [[ $1 == 1 ]]; then
SELECTION=$(slop)
maim -g $SELECTION ~/pictures/$(date +%m-%d-%Y:%R:%S).png && notify-send "screenshot saved" -i :
else
maim ~/pictures/$(date +%m-%d-%Y:%R:%S).png && notify-send "screenshot saved" -i :
fi

7
bin/st-bat Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
VOLTAGE=$(cat /sys/class/power_supply/BAT1/voltage_now)
CURRENT=$(cat /sys/class/power_supply/BAT1/current_now)
POWER="$(echo "scale=2; $VOLTAGE*$CURRENT/1000000000000" | bc)W"
CHARGE="$(cat /sys/class/power_supply/BAT*/capacity)%"
echo "$CHARGE $POWER"
#echo $POWER >> .power_log

9
bin/st-dbus-mon Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
dbus-monitor --session "member='PropertiesChanged'" |
while read X; do
if [[ $X == *"Metadata"* ]]; then
TITLE=$(playerctl metadata title)
ARTIST=$(playerctl metadata artist)
notify-send "Now playing" "$TITLE - $ARTIST" -i :
fi
done

2
bin/st-disk Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
echo $(df / | awk 'NR==2 {print $6" "$5}')

9
bin/st-mem Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
MEMORY_USED=$(free -m | gawk 'NR==2 {print $3}')
if [ $MEMORY_USED -gt 1024 ]; then
MEMORY_USED="$(echo "scale=1; $MEMORY_USED / 1024" | bc)G"
else
MEMORY_USED="$MEMORY_USEDM"
fi
echo $MEMORY_USED

8
bin/st-power Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
POWER="$(pwrstat -status | grep "Load" | awk '{print $2}')W"
CHARGE=$(pwrstat -status | grep "Battery Capacity" | awk '{print $3$4}')
if [[ "$CHARGE" == "100%" ]]; then
echo $POWER
else
echo "$CHARGE $POWER"
fi

8
bin/st-rec Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
sleep 1
PID=$(pidof ffmpeg)
if [ -n "$PID" ]; then
echo " REC"
elif [ -z "$PID" ]; then
echo " IDLE"
fi

4
bin/st-temp Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
CPUTEMP=$(sensors | grep "Package id 0" | awk '{print $4}' | sed s/+// )
COOLANT_TEMP=$(liquidctl status | grep "Liquid temperature" | awk '{print $4$5}')
echo "$CPUTEMP // $COOLANT_TEMP"

7
bin/st-vol Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
VOLUME=$(wpctl get-volume @DEFAULT_SINK@)
if [[ $VOLUME =~ "MUTED" ]]; then
echo " MUTED"
fi
VOLUME=$(echo $VOLUME | sed s/"Volume: 0."//g)
echo "$VOLUME%"

15
bin/status Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
while true; do
BATTERY="$(cat /sys/class/power_supply/BAT1/capacity)%"
MEMORY_USED="$(free -m | awk 'NR==2 {print $3}')"
VOLUME=$(wpctl get-volume @DEFAULT_SINK@)
DATE_TIME=$(date +%m-%d-%Y" "%R:%S)
if [ "$MEMORY_USED" -gt 4096 ]; then
MEMORY_USED="$((MEMORY_USED/1024)) GiB"
else
MEMORY_USED="$MEMORY_USED MiB"
fi
xsetroot -name "$BATTERY $MEMORY_USED $VOLUME $DATE_TIME"
sleep 1
done

7
bin/sync_music Executable file
View File

@ -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

12
bin/volumectl Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
INCREMENT="2"
if [[ "$1" == "up" ]]; then
wpctl set-volume @DEFAULT_SINK@ $INCREMENT%+
elif [[ "$1" == "down" ]]; then
wpctl set-volume @DEFAULT_SINK@ $INCREMENT%-
elif [[ "$1" == "mute" ]]; then
wpctl set-mute @DEFAULT_SINK@ toggle
fi
kill -n 35 $(pidof dwmblocks)