bin: improve script documentation

This commit is contained in:
xeruf 2022-01-10 11:52:17 +01:00
parent aef761baaa
commit dc5a56d26c
6 changed files with 20 additions and 4 deletions

View File

@ -1,5 +1,6 @@
#!/bin/sh
# disk size usage information
# [l]ist [d]isks - disk size usage and partition info
# For an accurate percentage add "f" as argument which uses "df"
if test "$1" = "f"
then df -B1M -x tmpfs -x devtmpfs -x squashfs | awk -v a="\033[31m" -v b="\033[33m" -v c="\033[35m" -v n="\033[0m" 'NR==1 {printf "%-20s %6s %7s %9s %s\n",$1,$5,$3,$4,$6} NR>1 {u=strtonum($5); printf (u > 99) ? a : (u > 97) ? b : (u > 94) ? c : ""; printf "%-20s %6s %6.1fG %8.1fG %s\n",$1,$5,$3/1024,$4/1024,$6; printf n}'
else

14
.local/bin/scripts/musictags Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
# Generate audio tags using different parameters for a given music file
prefix="$(basename "$1_tags_")"
for leni in {0..3}; do
len=$(echo "3^$leni" | bc)
for ovi in {0..3}; do
ov=$(echo "3^$ovi" | bc)
filename="${prefix}l${leni}o$ovi.csv"
echo "Generating $filename"
python3 -m musicnn.tagger --topN 7 --length $len --overlap $ov "$1" \
--print --save "$filename" 2>/dev/null
done
done
paste "$prefix"*.csv

View File

@ -1,4 +1,5 @@
#!/bin/sh
# [t]ree [l]ist
# List files recursively with [dirsfirst] including hidden files (-a)
# showing sizes of directories (--du) and files in [h]uman readable form
# with forced [C]olorization and pipe into less

View File

@ -1,3 +1,3 @@
#!/bin/sh
# Remove executable flag from files
# Recursively remove executable flag from files
find $@ -type f -exec chmod a-x {} +

View File

@ -1,4 +1,4 @@
#!/bin/sh
# restarts VLS with the given paths
# Kill and launch VLC with the given files
killall -q vlc
vlc --no-qt-error-dialogs --qt-start-minimized --qt-notification 0 --loop --random "$@" >/dev/null 2>&1 &

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Blocks internet at night using iptables and enables it only upon request
# Migration to nftables is outstanding
# TODO Migrate to nftables
# Auto-elevate
test "$EUID" -eq 0 || exec sudo "$0" "$@"