config/shell: script fixes

This commit is contained in:
xeruf 2023-02-07 13:19:34 +01:00
parent e27c3dabda
commit 1e873ab6fa
8 changed files with 18 additions and 8 deletions

View File

@ -6,7 +6,7 @@ alias sc="$sudo systemctl"
alias scs="$sudo systemctl status" alias scs="$sudo systemctl status"
alias sce="$sudo systemctl enable --now" alias sce="$sudo systemctl enable --now"
alias sced="$sudo --preserve-env=EDITOR systemctl edit" alias sced="$sudo --preserve-env=EDITOR systemctl edit"
alias scr="$sudo systemctl reload-or-restart" alias scr="$sudo systemctl daemon-reload && $sudo systemctl reload-or-restart"
highlight() { echo "$1"; } highlight() { echo "$1"; }
status() { status() {
@ -28,8 +28,8 @@ status() {
fi fi
} }
alias u='$sudo apt update && sudo apt upgrade' alias u="$sudo apt update && $sudo apt upgrade"
alias ur='u && $sudo reboot' alias ur="u && $sudo reboot"
# Diff recursively # Diff recursively
difr() { diff --color=always --unified=1 --recursive "$@" | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen; } difr() { diff --color=always --unified=1 --recursive "$@" | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen; }

View File

@ -482,7 +482,7 @@ killJava() {
which exa >/dev/null && which exa >/dev/null &&
alias l='exa --icons --group-directories-first' && alias l='exa --icons --group-directories-first' &&
alias ll='l --long --extended --git --all' alias ll='l --long --git --all'
if which fd >/dev/null 2>&1 if which fd >/dev/null 2>&1
then fn() { $(command -v fd || echo fdfind) --hidden --no-ignore-vcs --one-file-system "$@" | less -F; } # [F]ind [n]o ignore then fn() { $(command -v fd || echo fdfind) --hidden --no-ignore-vcs --one-file-system "$@" | less -F; } # [F]ind [n]o ignore

View File

@ -155,3 +155,5 @@ subhighlight "Setup kakoune plugin loader"
cloneshallow plug.kak robertmeta "$XDG_CONFIG_HOME/kak/plugins/plug.kak" cloneshallow plug.kak robertmeta "$XDG_CONFIG_HOME/kak/plugins/plug.kak"
touch $HOME/.local/state/wget-hsts touch $HOME/.local/state/wget-hsts
dasht-docsets-install haskell rails_4 >/dev/null

5
.local/bin/scripts/black Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh -e
# Suspend screen until enter is pressed
xset dpms force off
read
xset dpms force on

View File

@ -6,8 +6,8 @@ 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"
apprise $(pass service/apprise/intentions | head -1) -t 'janeks intention' -b "$intention"
fi fi

View File

@ -1,7 +1,9 @@
#!/bin/sh #!/bin/sh
# shows size statistics for subfolders # shows size statistics for subfolders
# max depth is equal to the first argument if it is a number or 1 # max depth is equal to the first argument if it is a number or 1
export chars=$(expr $(tput cols) - 60)
case "$1" in (+*) size=${1#+}; depth=2; shift;; esac case "$1" in (+*) size=${1#+}; depth=2; shift;; esac
case "$1" in ([0-9]) depth=$1; shift;; esac case "$1" in ([0-9]) depth=$1; shift;; esac
(du --max-depth "${depth:-1}" -xhat ${size:-50}M "$@" | sort -h | grep -v "^0") || (du --max-depth "${depth:-1}" -xhat ${size:-50}M "$@" | sort -h | grep -v "^0") |
while read line; do echo "$line $(pacman -Qqo $(echo $line | awk '{print $2}') 2>/dev/null | paste -s -d',' | sed "s/\(.\{${chars}\}\).*/\1.../")"; done || #| column -t ||
(du --max-depth "${depth:-1}" -xha "$@" | sort -h | tail) (du --max-depth "${depth:-1}" -xha "$@" | sort -h | tail)

View File

@ -1,5 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
# Install syncthingtray with dependencies # Install syncthingtray, preventing conflicts
# Pass -git as argument to install the git version with dependencies
pacman -Qq | grep '^syncthingtray' | xargs -r yay --noconfirm -R pacman -Qq | grep '^syncthingtray' | xargs -r yay --noconfirm -R
suffix=$1 suffix=$1
yay --noconfirm -Syy --nobatchinstall boost c++utilities$suffix qtforkawesome$suffix qtutilities$suffix yay --noconfirm -Syy --nobatchinstall boost c++utilities$suffix qtforkawesome$suffix qtutilities$suffix

View File

@ -13,7 +13,7 @@ case $1 in
esac esac
test $# -eq 0 || $cmd -vi "$@" "$dir/LINUX" test $# -eq 0 || $cmd -vi "$@" "$dir/LINUX"
find "$dir" -type f -iname "*32-*.iso" -exec mv -vi {} {}def32 \; find "$dir" -type f -iname "*32-*.iso" -exec mv -vi {} {}def32 \;
find "$dir" -type f -iname "*.iso" -exec mv -vi {} {}def64 \; find "$dir" -type f -name "*.iso" -exec mv -vi {} {}def64 \;
drive=$(mount | grep "$(dirname "$dir")" | cut -d' ' -f1) drive=$(mount | grep "$(dirname "$dir")" | cut -d' ' -f1)
sudo umount $drive sudo umount $drive
sudo udefrag $drive sudo udefrag $drive