config/shell: various tweaks

This commit is contained in:
xeruf 2021-11-23 13:03:43 +01:00
parent 8715a26674
commit 79f72ac614
7 changed files with 14 additions and 12 deletions

View File

@ -15,7 +15,9 @@ playlist_plugin {
enabled "true"
}
volume_normalization "yes"
replaygain "track"
auto_update "yes"
restore_paused "yes"
follow_outside_symlinks "yes"

View File

@ -191,7 +191,7 @@ alias grp='grep --color=auto --line-number --ignore-case --binary-files=without-
grpr() { grp --color=always --recursive $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "$@" | less -F }
# Recover stray swap files from neovim
alias vrec="ls $XDG_DATA_HOME/nvim/swap | sed 's/\%/\//g' | sed 's|\(.*\)\..*|\1|' | head -1 | xargs -r nvim"
alias vrec="ls $XDG_DATA_HOME/nvim/swap | sed 's/\%/\//g' | sed 's|\(.*\)\..*|\1|' | head -1 | xargs --no-run-if-empty nvim"
alias vrecd="ls $XDG_DATA_HOME/nvim/swap | head -1 | xargs -r -i mv {} /tmp"
# I think this was something about recovering backup files

View File

@ -9,10 +9,7 @@ set -eo pipefail
for last; do true; done
last=${last:-.}
# Elevate permissions if the file is not accessible
test -x "$(dirname "$last")" &&
{ test -r "$last" || ! test -e "$last"; } ||
elevate=sudo
checkaccess -r "$last" || elevate=sudo
tput setaf 4 && $elevate file -E "$last" | { grep -v --color=never 'directory$' || true; }
case "$($elevate file --dereference --mime "$last")" in

View File

@ -6,10 +6,12 @@ case $1 in
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"
one="$(basename "$1")"
two="$(basename "$2")"
diff="/tmp/diff-$one-$two.wav"
ffmpeg -y -v warning -i "$1" "/tmp/$one.wav"
ffmpeg -y -v warning -i "$2" "/tmp/$two.wav"
sox -m -v 1 "/tmp/$one.wav" -v -1 "/tmp/$two.wav" "$diff"
$0 "$diff"
;;
(*)

View File

@ -1,4 +1,5 @@
#!/bin/sh
kdeconnect-cli --refresh
if ! test -f "$1"; then echo "Please specify a file to share" && exit 1; fi
file="$1"
device="$(kdeconnect-cli --list-available 2>/dev/null | fzf -0 -1 | cut -d' ' -f3)"

View File

@ -9,7 +9,7 @@ do
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
else find "$f" -maxdepth 4 -empty -printf "Removing empty %p\n" -delete
test -e "$f" && echo -n "$f " >&2 && $elevate rm -rI "$f"
fi
else $elevate rm -i "$f"

View File

@ -1,11 +1,11 @@
#!/bin/sh
# disk size usage information
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}'
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
IFS="\n"
cols=$(tput cols)
lsblk --output name,size,fsuse%,mountpoints,label$(test $cols -gt 110 && echo ',uuid,fstype') --width $cols |
lsblk --output name,size,fsavail,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"