config/shell: various tweaks
This commit is contained in:
parent
8715a26674
commit
79f72ac614
|
@ -15,7 +15,9 @@ playlist_plugin {
|
||||||
enabled "true"
|
enabled "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
volume_normalization "yes"
|
||||||
replaygain "track"
|
replaygain "track"
|
||||||
auto_update "yes"
|
auto_update "yes"
|
||||||
|
restore_paused "yes"
|
||||||
|
|
||||||
follow_outside_symlinks "yes"
|
follow_outside_symlinks "yes"
|
||||||
|
|
|
@ -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 }
|
grpr() { grp --color=always --recursive $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "$@" | less -F }
|
||||||
|
|
||||||
# Recover stray swap files from neovim
|
# 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"
|
alias vrecd="ls $XDG_DATA_HOME/nvim/swap | head -1 | xargs -r -i mv {} /tmp"
|
||||||
|
|
||||||
# I think this was something about recovering backup files
|
# I think this was something about recovering backup files
|
||||||
|
|
|
@ -9,10 +9,7 @@ set -eo pipefail
|
||||||
for last; do true; done
|
for last; do true; done
|
||||||
last=${last:-.}
|
last=${last:-.}
|
||||||
|
|
||||||
# Elevate permissions if the file is not accessible
|
checkaccess -r "$last" || elevate=sudo
|
||||||
test -x "$(dirname "$last")" &&
|
|
||||||
{ test -r "$last" || ! test -e "$last"; } ||
|
|
||||||
elevate=sudo
|
|
||||||
tput setaf 4 && $elevate file -E "$last" | { grep -v --color=never 'directory$' || true; }
|
tput setaf 4 && $elevate file -E "$last" | { grep -v --color=never 'directory$' || true; }
|
||||||
|
|
||||||
case "$($elevate file --dereference --mime "$last")" in
|
case "$($elevate file --dereference --mime "$last")" in
|
||||||
|
|
|
@ -6,10 +6,12 @@ case $1 in
|
||||||
for arg; do $0 "$arg"; done
|
for arg; do $0 "$arg"; done
|
||||||
;;
|
;;
|
||||||
(-d) shift
|
(-d) shift
|
||||||
diff="/tmp/diff-$1-$2.wav"
|
one="$(basename "$1")"
|
||||||
ffmpeg -y -v warning -i "$1" "/tmp/$1.wav"
|
two="$(basename "$2")"
|
||||||
ffmpeg -y -v warning -i "$2" "/tmp/$2.wav"
|
diff="/tmp/diff-$one-$two.wav"
|
||||||
sox -m -v 1 "/tmp/$1.wav" -v -1 "/tmp/$2.wav" "$diff"
|
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"
|
$0 "$diff"
|
||||||
;;
|
;;
|
||||||
(*)
|
(*)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
kdeconnect-cli --refresh
|
||||||
if ! test -f "$1"; then echo "Please specify a file to share" && exit 1; fi
|
if ! test -f "$1"; then echo "Please specify a file to share" && exit 1; fi
|
||||||
file="$1"
|
file="$1"
|
||||||
device="$(kdeconnect-cli --list-available 2>/dev/null | fzf -0 -1 | cut -d' ' -f3)"
|
device="$(kdeconnect-cli --list-available 2>/dev/null | fzf -0 -1 | cut -d' ' -f3)"
|
||||||
|
|
|
@ -9,7 +9,7 @@ do
|
||||||
then echo -n "Force delete git project $f? "
|
then echo -n "Force delete git project $f? "
|
||||||
read answer
|
read answer
|
||||||
test "$answer" = "y" && $elevate rm -rf "$f"
|
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"
|
test -e "$f" && echo -n "$f " >&2 && $elevate rm -rI "$f"
|
||||||
fi
|
fi
|
||||||
else $elevate rm -i "$f"
|
else $elevate rm -i "$f"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# disk size usage information
|
# disk size usage information
|
||||||
if test "$1" = "f"
|
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
|
else
|
||||||
IFS="\n"
|
IFS="\n"
|
||||||
cols=$(tput cols)
|
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
|
while read line
|
||||||
do p=$(echo "$line" | sed 's|.* \([[:digit:]]\+\)%.*|\1|;t;c0')
|
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"
|
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"
|
||||||
|
|
Loading…
Reference in New Issue