Compare commits

..

2 Commits

Author SHA1 Message Date
xeruf 5f55c4bbd2 config: improved matching 2023-01-31 19:10:27 +01:00
xeruf 07885afa1b bin: various little script enhancements 2023-01-31 18:58:36 +01:00
11 changed files with 44 additions and 28 deletions

View File

@ -123,8 +123,8 @@ Version 2019-11-04 2021-02-16"
:desc "Markdown to Zulip" "mam" "gg4dip :desc "Markdown to Zulip" "mam" "gg4dip
:%s/<\\/?span ?[^ >]*>//g :%s/<\\/?span ?[^ >]*>//g
:%s/\\n\\n<a id=.*<\\/a>\\n\\n//g :%s/\\n\\n<a id=.*<\\/a>\\n\\n//g
:%s/<\\(http[^ \\n]+\\)>/\\1/g :%s/<\\(http[^ \\n]+\\)>/\\1/g "
:%s/\\\\<\\(.*\\)\\\\>/<\\1>/g " ;:%s/\\\\<\\([^ \\n]+\\)\\\\>/<\\1>/g "
;:%s/\\n *\\n /\\n / ;:%s/\\n *\\n /\\n /
;:%s/ / /g " ;:%s/ / /g "
) )

View File

@ -9,6 +9,10 @@ matches:
replace: |- replace: |-
Best, Best,
Janek Janek
- trigger: ";greg"
replace: |-
Greetings from Germany,
Janek
- trigger: ";date" - trigger: ";date"
replace: "{{mydate}}" replace: "{{mydate}}"
vars: vars:

View File

@ -8,6 +8,7 @@
"/home/janek/.local/share/puddletag/actions/Artist splitting.action", "/home/janek/.local/share/puddletag/actions/Artist splitting.action",
"/home/janek/.local/share/puddletag/actions/Genre Splitting.action", "/home/janek/.local/share/puddletag/actions/Genre Splitting.action",
"/home/janek/.local/share/puddletag/actions/Swap artists.action", "/home/janek/.local/share/puddletag/actions/Swap artists.action",
"/home/janek/.local/share/puddletag/actions/Genre Christian.action",
"/home/janek/.local/share/puddletag/actions/Genre House.action", "/home/janek/.local/share/puddletag/actions/Genre House.action",
"/home/janek/.local/share/puddletag/actions/Genre Acoustic.action", "/home/janek/.local/share/puddletag/actions/Genre Acoustic.action",
"/home/janek/.local/share/puddletag/actions/Genre Canto.action", "/home/janek/.local/share/puddletag/actions/Genre Canto.action",
@ -17,7 +18,7 @@
}, },
"main": { "main": {
"lang": "auto", "lang": "auto",
"lastfolder": "/home/janek/data/4-media/music/Electronic/Feint", "lastfolder": "/home/janek/data/4-media/music/Worship/Qobuz-commandes",
"maximized": false "maximized": false
}, },
"playlist": { "playlist": {
@ -44,7 +45,7 @@
"fontsize": 10, "fontsize": 10,
"rowsize": 43, "rowsize": 43,
"sort_fields": [ "sort_fields": [
"title" "album"
], ],
"sort_reverse": false "sort_reverse": false
}, },
@ -131,7 +132,8 @@
"checked": [ "checked": [
"Standard", "Standard",
"Artist splitting", "Artist splitting",
"Genre Splitting" "Genre Splitting",
"Genre: Christian"
] ]
}, },
"quick_actions": { "quick_actions": {

View File

@ -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
} }

View File

@ -481,7 +481,7 @@ killJava() {
# Files {{{1 # Files {{{1
which exa >/dev/null && which exa >/dev/null &&
alias l='exa --icons' && alias l='exa --icons --group-directories-first' &&
alias ll='l --long --extended --git --all' alias ll='l --long --extended --git --all'
if which fd >/dev/null 2>&1 if which fd >/dev/null 2>&1

View File

@ -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;

View File

@ -42,6 +42,7 @@ 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' &&
$inspect ||
$elevate ffprobe -hide_banner "$arg" 2>&1 | grep "bitrate: ....\? " | sed 's/, start:[^,]\+,/,/' || $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)" &&
@ -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"
;; ;;

View File

@ -7,18 +7,21 @@
# - host # - host
# - target directory name (and further arguments to clone) # - target directory name (and further arguments to clone)
# In an existing repo, first arg is omitted # In an existing repo, first arg is omitted
test $# -eq 0 && echo "Usage: $0 [repo (omit if in repo)] [upstream owner] [own user] [url]" && exit 2 if test -d ".git" # TODO search upwards
# TODO check from subdir
if test -d ".git"
then repo="$(basename "$PWD")" then repo="$(basename "$PWD")"
git remote set-url origin "$(git-repo "${3:-github.com}" "$repo" "$2" "${@:4}")" git remote set-url origin "$(git-repo "${3:-github.com}" "$repo" "${2:-$(git config --get user.name)}" "${@:4}")"
else repo="$1" && shift else test $# -eq 0 && echo "Usage: $0 [repo (omit if in repo)] [upstream owner] [own user] [url]" && exit 2
repo="$1" && shift
if test "$#" -eq 0
then git-get "$repo"
else
test -d "$d1" && cd "$d1/0-forks" test -d "$d1" && cd "$d1/0-forks"
if ! git-get "${3:-github.com}" "$repo" "${2:-$(git config --get user.name)}" "${@:4}" if ! git-get "${3:-github.com}" "$repo" "${2:-$(git config --get user.name)}" "${@:4}"
then repo="$1-$repo" then repo="$1-$repo"
git-get "${3:-github.com}" "$repo" "${2:-$(git config --get user.name)}" "${@:4}" git-get "${3:-github.com}" "$repo" "${2:-$(git config --get user.name)}" "${@:4}"
fi fi
cd "$(expr "$4" \| "$repo")" fi
cd "$(basename "$(expr "$4" \| "$repo")")"
fi fi
user="${1:-$repo}" user="${1:-$repo}"
git remote remove upstream 2>/dev/null || true git remote remove upstream 2>/dev/null || true

View File

@ -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"

View File

@ -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

View File

@ -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