From 4ff261c19f924461f82a665bbf8f75d2351afad9 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Fri, 31 May 2024 11:57:17 +0300 Subject: [PATCH] bin: update some defaults --- .config/bash/aliases.bash | 6 ++++++ .config/git/config | 1 + .config/shell/music | 6 +++--- .config/shell/server | 6 ++++++ .local/bin/scripts/boost | 2 +- .local/bin/scripts/dedup | 2 +- .local/bin/scripts/denest | 8 +++++--- .local/bin/scripts/jrnl-tag | 2 +- .zshenv | 4 ++-- 9 files changed, 26 insertions(+), 11 deletions(-) diff --git a/.config/bash/aliases.bash b/.config/bash/aliases.bash index fdd6d71..76f4ec2 100644 --- a/.config/bash/aliases.bash +++ b/.config/bash/aliases.bash @@ -2,6 +2,12 @@ test -n "$PS1" || return 0 which pfetch >/dev/null 2>&1 && pfetch +ds() { + 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 > 98) ? a : (u > 96) ? b : (u > 90) ? c : ""; printf "%-20s %6s %6.1fG %8.1fG %s\n",$1,$5,$3/1024,$4/1024,$6; printf n}' +} +ds + test $(id -u) -eq 0 || sudo=sudo alias jc="$sudo journalctl --boot --unit" diff --git a/.config/git/config b/.config/git/config index 312716f..3a1e42e 100644 --- a/.config/git/config +++ b/.config/git/config @@ -185,6 +185,7 @@ ruu = !git fetch upstream && git reset --keep upstream/${1:-$(git curbranch)} && git push --no-verify --force-with-lease luu = !git pull upstream ${1:-$(git curbranch)} && git push --no-verify pf = push --force-with-lease + pu = push --set-upstream # CLEANUP gcr = !git gc && git repack -a -d diff --git a/.config/shell/music b/.config/shell/music index 730e6eb..3170f11 100644 --- a/.config/shell/music +++ b/.config/shell/music @@ -91,12 +91,12 @@ formatin() { # Normalize the given filename formatsong() { - echo "$1" | sed -e '# First Entry for Qobuz folders - /^[A-z0-9_-]\+$/{s|_| |g;s|-|/|g}; + # Qobuz folders /^[A-z0-9_-]\+$/{s|_| |g;s|-|/|g}; + echo "$1" | sed -e ' s/\b\(ft\|Ft\|Feat\|featuring\)\([ .]\)/feat\2/; s/\bfeat /feat. /; s/)(/) (/g; - s/ [[(]\(Free Download\|Original Mix\|Original\|Full Stream\|NCS Release\)[])]//i; + s/ [[(]\(None\|Free Download\|Original Mix\|Original\|Full Stream\|NCS Release\)[])]//i; s/ (\(Acoustic\|Live|.* Remix\))/ [\1]/i; s/ \[\(feat.*\)\]/ (\1)/i; s/^\([A-z]\+\) The \([^-]\+\)$/\1, the \2/g; diff --git a/.config/shell/server b/.config/shell/server index b8439ec..dea2c77 100644 --- a/.config/shell/server +++ b/.config/shell/server @@ -72,6 +72,7 @@ stack() { fi;; (invite) ( # Mail invitation to new users + test $# -gt 0 || { printf "stack invite MAIL [NAME] [TEMPLATE]\nName can be omitted if mail is firstname.lastname@domain\n"; exit 2 }; export mail=$1 export name=${2:-$(echo $mail | sed -E 's/(.*)\.(.*)@.*/\u\1 \u\2/' )} #echo "$mail,$name" @@ -83,6 +84,7 @@ stack() { # Allow force: https://open.greenhost.net/xeruf/stackspout/-/settings/repository#js-protected-branches-settings git commit "$@" git push && + git push greenhost && # FIXME remove flux reconcile source git -n flux-system "$(basename $(git rev-parse --show-toplevel))" flux reconcile kustomization -n flux-system "$(basename $(git rev-parse --show-toplevel))" ;; @@ -237,6 +239,9 @@ stack() { "$cmdname" exec "$name" -it -- env "MYSQL_PWD=$(kubectl get secret -n $(kubectl get secret --all-namespaces -o=custom-columns=S:.metadata.namespace,N:.metadata.name --no-headers | grep --color=never -- "$name") -o jsonpath='{.data.mariadb-root-password}' | base64 -d)" mysql -u root "$@" ;; # high-level + (list) + flux get all | grep "$1" + kubectl get all -A | grep "$1";; (shell) local container=$1 shift @@ -288,6 +293,7 @@ stack() { return $? fi builtin cd "$STACKSPIN" + stack activate # Since the install command can also be given bare to install stackspin itself if test "$command" = "install"; then case "$1" in diff --git a/.local/bin/scripts/boost b/.local/bin/scripts/boost index 9b1279d..ab2bd4e 100755 --- a/.local/bin/scripts/boost +++ b/.local/bin/scripts/boost @@ -3,5 +3,5 @@ # Pass -git as argument to install the git version with dependencies pacman -Qq | grep -E '^(syncthingtray)' | xargs --no-run-if-empty yay -R --noconfirm suffix=$1 -yay --noconfirm -Syy --nobatchinstall --answerdiff none boost c++utilities$suffix qtforkawesome$suffix qtutilities$suffix +yay --noconfirm -Syy --answerdiff none boost c++utilities$suffix qtforkawesome$suffix qtutilities$suffix yay --noconfirm -S syncthingtray$suffix guitarix diff --git a/.local/bin/scripts/dedup b/.local/bin/scripts/dedup index 7f6f070..5a1ad6c 100755 --- a/.local/bin/scripts/dedup +++ b/.local/bin/scripts/dedup @@ -1,5 +1,5 @@ #!/bin/sh -e -rmlint --max-depth=5 --keep-hardlinked --rank-by=HpOdlam -o pretty -o sh:/tmp/dedup.sh "$@" +rmlint --max-depth=5 --keep-hardlinked --rank-by=HOpdlam -o pretty -o sh:/tmp/dedup.sh "$@" printf "Enter to confirm, any text to skip (answer does not matter if nothing was printed above this line) " read -r answer test -n "$answer" || /tmp/dedup.sh -d diff --git a/.local/bin/scripts/denest b/.local/bin/scripts/denest index 6bd8e6a..83ace67 100755 --- a/.local/bin/scripts/denest +++ b/.local/bin/scripts/denest @@ -1,7 +1,9 @@ #!/bin/sh -e # Flatten folder hierarchies -# Moves subfolders up one layer, replacing the slash by underscore unless the parent folder has the same name. -# Args: depth of leaf folders to move up +# Moves subfolders up N layers, replacing the slash by underscore unless the parent folder has the same name. +# Args: +# - [N - depth of leaf folders to move up] +# - [dirs to run in - default PWD] depth=$(expr 1 \& $# \| 2) case $1 in ([0-9]|[0-9][0-9]) depth=$1; shift;; esac find "$@" -mindepth $depth -maxdepth $depth -depth -type d | while read folder; do @@ -12,4 +14,4 @@ find "$@" -mindepth $depth -maxdepth $depth -depth -type d | while read folder; rm -d "$parent" && mv -v "$newname" "$parent" done -find -maxdepth $depth -empty -type d -delete +find "$@" -maxdepth $depth -empty -type d -delete diff --git a/.local/bin/scripts/jrnl-tag b/.local/bin/scripts/jrnl-tag index 2f4887f..58db18b 100755 --- a/.local/bin/scripts/jrnl-tag +++ b/.local/bin/scripts/jrnl-tag @@ -2,7 +2,7 @@ # Find terms in jrnl files and turn them into tags # Check with jrnl --tags if test $# -eq 0 -then $0 sleep uni work nap health tech read girl dev phone Zinc run bike tour laptop computer PC CB piano faith journal Catherine Franklin Kerstin Henri Katja Erlangen Bayreuth Berlin ICF +then $0 sleep uni nap cry health tech read girl dev phone Zinc run bike tour laptop computer PC piano faith journal CB Claudia Catherine Franklin Kerstin Henri Katja Erlangen Bayreuth Berlin ICF else for arg do rpl "\(^\|[^@]\)\b$arg\b" "\1@$arg" $JOURNAL/*.txt 2>/dev/null diff --git a/.zshenv b/.zshenv index ceab441..42d2b08 100644 --- a/.zshenv +++ b/.zshenv @@ -102,7 +102,7 @@ export LESS="--raw-control-chars --ignore-case --LONG-PROMPT --jump-target=5 $(t # TODO put into config file and use --exclude-from # -x 'System Volume Information' export DIRS_GENERATED="-x generated -x .gradle -x cmake_build -x dist-newstyle -x node_modules -x __pycache__ -x .pytest_cache" -export DIRS_IGNORE_SAFE="-x .cache -x .cpan -x *Cache -x .pyenv -x .local/cache -x .config/DeltaChat -x .config/discord -x .config/Slack -x .config/syncthing -x share/baloo -x share/cabal -x share/cargo -x share/digikam -x share/gem -x share/JetBrains -x share/tldr -x share/syncthing -x share/Steam/ubuntu* -x share/Steam/package -x share/virtualenv -x share/Zeal -x state/gradle -x state/android -x Ferdi/Partitions -x oh-my-zsh -x wine/drive_c/windows -x vendor/cache $DIRS_GENERATED" +export DIRS_IGNORE_SAFE="-x .cache -x .cpan -x *Cache -x .dtrash -x .pyenv -x .local/cache -x .config/DeltaChat -x .config/discord -x .config/Slack -x .config/syncthing -x share/baloo -x share/cabal -x share/cargo -x share/digikam -x share/gem -x share/JetBrains -x share/tldr -x share/syncthing -x share/Steam/ubuntu* -x share/Steam/package -x share/virtualenv -x share/Zeal -x state/gradle -x state/android -x Ferdi/Partitions -x oh-my-zsh -x wine/drive_c/windows -x vendor/cache $DIRS_GENERATED" export DIRS_IGNORE="-x .archive -x .sync -x .stfolder -x *build -x .git -x .idea -x env -x out -x cache -x Partitions -x vendor/bundle -x log $DIRS_IGNORE_SAFE" # red stderr test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}" @@ -158,6 +158,6 @@ export CTEST_OUTPUT_ON_FAILURE=1 # TODO move to proper place - is also called when firenvim starts #autolight #export TZ='Europe/Dublin' -#export TZ='Africa/Nairobi' +export TZ='Africa/Nairobi' export CONTEST_NETWORK=lan-restricted-dev