bin: update some defaults

This commit is contained in:
xeruf 2024-05-31 11:57:17 +03:00
parent dea1732727
commit 4ff261c19f
9 changed files with 26 additions and 11 deletions

View File

@ -2,6 +2,12 @@ test -n "$PS1" || return 0
which pfetch >/dev/null 2>&1 && pfetch 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 test $(id -u) -eq 0 || sudo=sudo
alias jc="$sudo journalctl --boot --unit" alias jc="$sudo journalctl --boot --unit"

View File

@ -185,6 +185,7 @@
ruu = !git fetch upstream && git reset --keep upstream/${1:-$(git curbranch)} && git push --no-verify --force-with-lease 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 luu = !git pull upstream ${1:-$(git curbranch)} && git push --no-verify
pf = push --force-with-lease pf = push --force-with-lease
pu = push --set-upstream
# CLEANUP # CLEANUP
gcr = !git gc && git repack -a -d gcr = !git gc && git repack -a -d

View File

@ -91,12 +91,12 @@ formatin() {
# Normalize the given filename # Normalize the given filename
formatsong() { formatsong() {
echo "$1" | sed -e '# First Entry for Qobuz folders # Qobuz folders /^[A-z0-9_-]\+$/{s|_| |g;s|-|/|g};
/^[A-z0-9_-]\+$/{s|_| |g;s|-|/|g}; echo "$1" | sed -e '
s/\b\(ft\|Ft\|Feat\|featuring\)\([ .]\)/feat\2/; 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/ [[(]\(None\|Free Download\|Original Mix\|Original\|Full Stream\|NCS Release\)[])]//i;
s/ (\(Acoustic\|Live|.* Remix\))/ [\1]/i; s/ (\(Acoustic\|Live|.* Remix\))/ [\1]/i;
s/ \[\(feat.*\)\]/ (\1)/i; s/ \[\(feat.*\)\]/ (\1)/i;
s/^\([A-z]\+\) The \([^-]\+\)$/\1, the \2/g; s/^\([A-z]\+\) The \([^-]\+\)$/\1, the \2/g;

View File

@ -72,6 +72,7 @@ stack() {
fi;; fi;;
(invite) ( (invite) (
# Mail invitation to new users # 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 mail=$1
export name=${2:-$(echo $mail | sed -E 's/(.*)\.(.*)@.*/\u\1 \u\2/' )} export name=${2:-$(echo $mail | sed -E 's/(.*)\.(.*)@.*/\u\1 \u\2/' )}
#echo "$mail,$name" #echo "$mail,$name"
@ -83,6 +84,7 @@ stack() {
# Allow force: https://open.greenhost.net/xeruf/stackspout/-/settings/repository#js-protected-branches-settings # Allow force: https://open.greenhost.net/xeruf/stackspout/-/settings/repository#js-protected-branches-settings
git commit "$@" git commit "$@"
git push && git push &&
git push greenhost && # FIXME remove
flux reconcile source git -n flux-system "$(basename $(git rev-parse --show-toplevel))" 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))" 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 "$@" "$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 # high-level
(list)
flux get all | grep "$1"
kubectl get all -A | grep "$1";;
(shell) (shell)
local container=$1 local container=$1
shift shift
@ -288,6 +293,7 @@ stack() {
return $? return $?
fi fi
builtin cd "$STACKSPIN" builtin cd "$STACKSPIN"
stack activate
# Since the install command can also be given bare to install stackspin itself # Since the install command can also be given bare to install stackspin itself
if test "$command" = "install"; then if test "$command" = "install"; then
case "$1" in case "$1" in

View File

@ -3,5 +3,5 @@
# Pass -git as argument to install the git version with dependencies # Pass -git as argument to install the git version with dependencies
pacman -Qq | grep -E '^(syncthingtray)' | xargs --no-run-if-empty yay -R --noconfirm pacman -Qq | grep -E '^(syncthingtray)' | xargs --no-run-if-empty yay -R --noconfirm
suffix=$1 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 yay --noconfirm -S syncthingtray$suffix guitarix

View File

@ -1,5 +1,5 @@
#!/bin/sh -e #!/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) " printf "Enter to confirm, any text to skip (answer does not matter if nothing was printed above this line) "
read -r answer read -r answer
test -n "$answer" || /tmp/dedup.sh -d test -n "$answer" || /tmp/dedup.sh -d

View File

@ -1,7 +1,9 @@
#!/bin/sh -e #!/bin/sh -e
# Flatten folder hierarchies # Flatten folder hierarchies
# Moves subfolders up one layer, replacing the slash by underscore unless the parent folder has the same name. # Moves subfolders up N layers, replacing the slash by underscore unless the parent folder has the same name.
# Args: depth of leaf folders to move up # Args:
# - [N - depth of leaf folders to move up]
# - [dirs to run in - default PWD]
depth=$(expr 1 \& $# \| 2) depth=$(expr 1 \& $# \| 2)
case $1 in ([0-9]|[0-9][0-9]) depth=$1; shift;; esac 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 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" && rm -d "$parent" &&
mv -v "$newname" "$parent" mv -v "$newname" "$parent"
done done
find -maxdepth $depth -empty -type d -delete find "$@" -maxdepth $depth -empty -type d -delete

View File

@ -2,7 +2,7 @@
# Find terms in jrnl files and turn them into tags # Find terms in jrnl files and turn them into tags
# Check with jrnl --tags # Check with jrnl --tags
if test $# -eq 0 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 else
for arg for arg
do rpl "\(^\|[^@]\)\b$arg\b" "\1@$arg" $JOURNAL/*.txt 2>/dev/null do rpl "\(^\|[^@]\)\b$arg\b" "\1@$arg" $JOURNAL/*.txt 2>/dev/null

View File

@ -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 # TODO put into config file and use --exclude-from
# -x 'System Volume Information' # -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_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" 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 # red stderr
test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}" 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 # TODO move to proper place - is also called when firenvim starts
#autolight #autolight
#export TZ='Europe/Dublin' #export TZ='Europe/Dublin'
#export TZ='Africa/Nairobi' export TZ='Africa/Nairobi'
export CONTEST_NETWORK=lan-restricted-dev export CONTEST_NETWORK=lan-restricted-dev