bin: fix oversights & improve freq
This commit is contained in:
parent
65201a3ba8
commit
32ccac9184
|
@ -44,9 +44,8 @@ fi
|
|||
|
||||
highlight "d to recursively remove development caches"
|
||||
if [[ $1 =~ "d" ]]; then
|
||||
rm -rf .npm .yarn
|
||||
arg-test -name "src" -prune -o \
|
||||
-type d \( -name 'cache' $(echo $DIRS_GENERATED | sed 's|-x \([^ ]\+\)|-o -name "\1"|g') \
|
||||
find -name "src" -prune -o \
|
||||
-type d \( -name 'cache' $(echo $DIRS_GENERATED | sed 's|-x \([^ ]\+\)|-o -name \1|g') \) \
|
||||
-print -exec rm -r {} + -prune
|
||||
echo -n " " && highlight "build directories"
|
||||
find $DATA/2-standards/dev/aur -mindepth 2 -maxdepth 2 -type d -not -name ".*" \
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
#!/bin/sh
|
||||
# Show a frequance spectrogram using sox and timg
|
||||
out=${2:-/tmp/$1-sox.png}
|
||||
mkdir -p "$(dirname "$out")"
|
||||
sox "$1" -n spectrogram -o "$out"
|
||||
timg --title "$out"
|
||||
# Show a frequence spectrogram using sox and timg
|
||||
# https://sound.stackexchange.com/questions/40226/show-the-differences-between-two-similar-audio-files-using-graphical-method
|
||||
case $1 in
|
||||
(-a) shift
|
||||
for arg; do $0 "$arg"; done
|
||||
;;
|
||||
(-d) shift
|
||||
diff="/tmp/diff-$1-$2.wav"
|
||||
ffmpeg -y -v warning -i "$1" "/tmp/$1.wav"
|
||||
ffmpeg -y -v warning -i "$2" "/tmp/$2.wav"
|
||||
sox -m -v 1 "/tmp/$1.wav" -v -1 "/tmp/$2.wav" "$diff"
|
||||
$0 "$diff"
|
||||
;;
|
||||
(*)
|
||||
out="${2:-/tmp/freq-$(basename "$1").png}"
|
||||
mkdir -p "$(dirname "$out")"
|
||||
sox "$1" -n spectrogram -o "$out"
|
||||
timg --title "$out"
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -6,7 +6,7 @@ do
|
|||
test -w "$f" && elevate="" || elevate=sudo
|
||||
if test -d "$f"; then
|
||||
if test -e "$f/.git" || test -e "$f/packed-refs"
|
||||
then echo -n "Force delete git project $f?"
|
||||
then echo -n "Force delete git project $f? "
|
||||
read answer
|
||||
test "$answer" = "y" && $elevate rm -rf "$f"
|
||||
else find "$f" -maxdepth 4 -type d -empty -printf "Removing empty %p\n" -delete
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
#!/bin/sh
|
||||
# disk size usage information
|
||||
IFS="\n"
|
||||
cols=$(tput cols)
|
||||
lsblk --output name,size,fsuse%,mountpoints,label$(test $cols -gt 110 && echo ',uuid,fstype') --width $cols |
|
||||
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/1000,$4/1000,$6; printf n}'
|
||||
else
|
||||
IFS="\n"
|
||||
cols=$(tput cols)
|
||||
lsblk --output name,size,fsuse%,mountpoints,label$(test $cols -gt 110 && echo ',uuid,fstype') --width $cols |
|
||||
while read line
|
||||
do p=$(echo "$line" | sed 's|.* \([[:digit:]]\+\)%.*|\1|;t;c0')
|
||||
printf "$(expr "$line" : " " >/dev/null || echo "\033[$(test -z "$first" && echo "4" || expr "5;31" \& "$p" \> 98 \| "31" \& "$p" \> 97 \| "33" \& "$p" \> 94 \| "35" \& "$p" \> 90)m")%s\n" "$line"
|
||||
first=1
|
||||
done
|
||||
# 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/1000,$4/1000,$6; printf n}'
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue