bin: script adjustments

This commit is contained in:
xeruf 2024-06-28 22:34:05 +03:00
parent d1ef716aa4
commit ce97eb526b
6 changed files with 14 additions and 7 deletions

View File

@ -89,11 +89,14 @@ if [[ $1 =~ "o" ]]; then
fi fi
sudo rm -rf "$XDG_DATA_HOME/baloo" sudo rm -rf "$XDG_DATA_HOME/baloo"
docker image prune # https://www.cyberciti.biz/faq/delete-remove-orphaned-unused-packages-arch-linux-pacman-command/
which pacman &>/dev/null &&
pacman -Qqdt | sudo pacman -Rsu -
which yay &>/dev/null && which yay &>/dev/null &&
yay -Sc --noconfirm yay -Sc --noconfirm
nix-collect-garbage -d 2>/dev/null && nix-collect-garbage -d 2>/dev/null &&
nix-store --optimize nix-store --optimize
docker image prune
fi fi
df --output="source,avail" -h $(test -n "$local" && echo ".") "$dir" df --output="source,avail" -h $(test -n "$local" && echo ".") "$dir"

View File

@ -2,7 +2,8 @@
# [d]isk [s]ize usage and partition overview # [d]isk [s]ize usage and partition overview
# For an accurate usage percentage add "f" as argument which uses "df" # For an accurate usage percentage add "f" as argument which uses "df"
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/1024,$4/1024,$6; printf n}' then df -B1M -x tmpfs -x devtmpfs -x squashfs -x overlay |
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=$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
test "$(lsblk --version | cut -d. -f2)" -ge 37 && width="--width" && cols=$(tput cols) && outcols="s" test "$(lsblk --version | cut -d. -f2)" -ge 37 && width="--width" && cols=$(tput cols) && outcols="s"
IFS="\n" IFS="\n"

View File

@ -26,7 +26,7 @@ showinfo() {
cmd="$1" cmd="$1"
case "$cmd" in case "$cmd" in
(fwupdmgr|hunt|rdoc|gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker|jrnl|difft|wiked-diff|qpdf|ninja) (fwupdmgr|hunt|rdoc|gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker|jrnl|difft|wiked-diff|qpdf|ninja|qobuz-dl|beet)
unbuffer "$@" --help | sed 's|^[^ ].*:|\0|' | $paginate;; unbuffer "$@" --help | sed 's|^[^ ].*:|\0|' | $paginate;;
(sqlcmd) sqlcmd -?;; (sqlcmd) sqlcmd -?;;
(exa) "$0" eza;; (exa) "$0" eza;;

View File

@ -2,9 +2,9 @@
# 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 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 then $0 sleep lens uni nap cry health tech read girl dev phone Zinc bike tour laptop computer PC piano faith CB Claudia Franklin Kerstin Henri Katja Erlangen Bayreuth Berlin ICF Joan
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
done done
fi fi

View File

@ -6,3 +6,4 @@ case "$1" in
(-*) u="${1#-}"; shift; break;; (-*) u="${1#-}"; shift; break;;
esac esac
sudo chown -R --preserve-root "$u:$u" "${@:-.}" sudo chown -R --preserve-root "$u:$u" "${@:-.}"
#sudo chmod u+w . -R

6
.local/bin/scripts/wg-reload Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/bin/sh -x #!/bin/bash -x
# wg-quick reload interface # wg-quick reload interface
wg syncconf "$@" <(wg-quick strip "$@") # needs to be run with superuser permissions
wg syncconf "$@" <(wg-quick strip "$@") ||
ip -br a