bin: various little script enhancements
This commit is contained in:
parent
9f0aae589a
commit
07885afa1b
|
@ -22,7 +22,7 @@ yzf() {
|
||||||
sed "s/ /\t/g" |
|
sed "s/ /\t/g" |
|
||||||
fzf --nth=$pos --multi --history="${FZF_HISTDIR:-$XDG_STATE_HOME/fzf}/history-yzf$pos" \
|
fzf --nth=$pos --multi --history="${FZF_HISTDIR:-$XDG_STATE_HOME/fzf}/history-yzf$pos" \
|
||||||
--preview-window=60%,border-left \
|
--preview-window=60%,border-left \
|
||||||
--bind="double-click:execute(xdg-open 'https://archlinux.org/packages/{$pos}'),alt-enter:execute(xdg-open 'https://aur.archlinux.org/packages?K={$pos}&SB=p&SO=d&PP=100')" \
|
--bind="alt-bspace:clear-query,double-click:execute(xdg-open 'https://archlinux.org/packages/{$pos}'),alt-enter:execute(xdg-open 'https://aur.archlinux.org/packages?K={$pos}&SB=p&SO=d&PP=100')" \
|
||||||
"$@" | cut -f$pos | xargs
|
"$@" | cut -f$pos | xargs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ addalbum() {
|
||||||
|
|
||||||
formatsongs() {
|
formatsongs() {
|
||||||
(
|
(
|
||||||
find -maxdepth 1 -type d | formatin
|
find -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | formatin
|
||||||
find "$@" "$PWD" -type d | while read d;
|
find "$@" "$PWD" -type d | while read d;
|
||||||
do builtin cd "$d" && findsongs | formatin
|
do builtin cd "$d" && findsongs | formatin
|
||||||
done
|
done
|
||||||
|
@ -83,13 +83,17 @@ formatsongs() {
|
||||||
formatin() {
|
formatin() {
|
||||||
while read song; do
|
while read song; do
|
||||||
new="$(formatsong "$song")"
|
new="$(formatsong "$song")"
|
||||||
test "$new" && test "$new" != "$song" && mv -iv "$song" "$new"
|
if test "$new" && test "$new" != "$song"
|
||||||
|
then mkdir -p "$(dirname "$new")" && mv -iv "$song" "$new"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Normalize the given filename
|
# Normalize the given filename
|
||||||
formatsong() {
|
formatsong() {
|
||||||
echo "$1" | sed -e 's/\b\(ft\|Ft\|Feat\|featuring\)\([ .]\)/feat\2/;
|
echo "$1" | sed -e '# First Entry for Qobuz folders
|
||||||
|
/^[A-z0-9_-]\+$/{s|_| |g;s|-|/|g};
|
||||||
|
s/\b\(ft\|Ft\|Feat\|featuring\)\([ .]\)/feat\2/;
|
||||||
s/\bfeat /feat. /;
|
s/\bfeat /feat. /;
|
||||||
s/)(/) (/g;
|
s/)(/) (/g;
|
||||||
s/ [[(]\(Free Download\|Original Mix\|Original\|Full Stream\|NCS Release\)[])]//i;
|
s/ [[(]\(Free Download\|Original Mix\|Original\|Full Stream\|NCS Release\)[])]//i;
|
||||||
|
|
|
@ -42,7 +42,8 @@ fileinfo() {
|
||||||
# TODO do not grep bitrate but extract properly
|
# TODO do not grep bitrate but extract properly
|
||||||
#probe="$($elevate ffprobe "$arg" 2>&1)"
|
#probe="$($elevate ffprobe "$arg" 2>&1)"
|
||||||
#echo $probe | grep -v -e '00:00:00.04' -e 'ansi' &&
|
#echo $probe | grep -v -e '00:00:00.04' -e 'ansi' &&
|
||||||
$elevate ffprobe -hide_banner "$arg" 2>&1 | grep "bitrate: ....\? " | sed 's/, start:[^,]\+,/,/' ||
|
$inspect ||
|
||||||
|
$elevate ffprobe -hide_banner "$arg" 2>&1 | grep "bitrate: ....\? " | sed 's/, start:[^,]\+,/,/' ||
|
||||||
$elevate stat --format "%U:%G %A %s $(
|
$elevate stat --format "%U:%G %A %s $(
|
||||||
size="$($elevate unzip -l "$arg" 2>/dev/null | tail -1)" &&
|
size="$($elevate unzip -l "$arg" 2>/dev/null | tail -1)" &&
|
||||||
echo "(uncompressed $(echo $size | cut -d' ' -f1 | numfmt --to=iec-i --suffix=B))"
|
echo "(uncompressed $(echo $size | cut -d' ' -f1 | numfmt --to=iec-i --suffix=B))"
|
||||||
|
@ -91,7 +92,7 @@ for arg; do
|
||||||
timg+=("$tmpfile");;
|
timg+=("$tmpfile");;
|
||||||
(*\ video/*)
|
(*\ video/*)
|
||||||
suffix=_thumbs.jpg
|
suffix=_thumbs.jpg
|
||||||
mtn -q -i -t -W -r2 -D6 -b 0,6 -c $grid -w $(expr $(tput cols) '*' 20) \
|
mtn -q -i -t -W -r$(expr 5 - $# \& $# \< 4 \| 1) -D6 -b 0.6 -c $grid -w $(expr $(tput cols) '*' 20) \
|
||||||
-O "$prefix" -o "$suffix" "$arg" &&
|
-O "$prefix" -o "$suffix" "$arg" &&
|
||||||
timg -W "$prefix/$(basename "${arg%.*}")$suffix"
|
timg -W "$prefix/$(basename "${arg%.*}")$suffix"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -6,6 +6,7 @@ if test -e "$JOURNAL"; then
|
||||||
do read intention
|
do read intention
|
||||||
done
|
done
|
||||||
jrnl intentions "$intention"
|
jrnl intentions "$intention"
|
||||||
|
apprise $(pass service/apprise/intentions) -t 'janeks intention' -b "$intention"
|
||||||
sudo nft flush chain inet filter outall
|
sudo nft flush chain inet filter outall
|
||||||
sudo nft add rule inet filter outall meta hour "$(date +%H:%M)"-"$(date +%H:%M --date="${1:-10}min")" accept
|
sudo nft add rule inet filter outall meta hour "$(date +%H:%M)"-"$(date +%H:%M --date="${1:-10}min")" accept
|
||||||
#expr \( "$1" \> 40 \) \* 10 \| "$1"
|
#expr \( "$1" \> 40 \) \* 10 \| "$1"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# TODO set brightness
|
# TODO set brightness? light -S
|
||||||
pkill electron
|
pkill electron
|
||||||
pkill discord
|
pkill --ignore-case discord
|
||||||
pkill signal
|
pkill signal
|
||||||
pkill aw-server
|
pkill aw-server
|
||||||
pkill aw-qt
|
pkill aw-qt
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/sh -ex
|
#!/bin/sh -e
|
||||||
# Install syncthingtray with dependencies
|
# Install syncthingtray with dependencies
|
||||||
|
pacman -Qq | grep '^syncthingtray' | xargs -r yay --noconfirm -R
|
||||||
suffix=$1
|
suffix=$1
|
||||||
yay --noconfirm -Syyu --nobatchinstall c++utilities$suffix qtforkawesome$suffix qtutilities$suffix
|
yay --noconfirm -Syy --nobatchinstall boost c++utilities$suffix qtforkawesome$suffix qtutilities$suffix
|
||||||
yay --noconfirm -S syncthingtray$suffix
|
yay --noconfirm -S syncthingtray$suffix
|
||||||
|
|
Loading…
Reference in New Issue