From 1e873ab6fad74e910d59b43a77e9a159502e6982 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 7 Feb 2023 13:19:34 +0100 Subject: [PATCH] config/shell: script fixes --- .bash_aliases | 6 +++--- .config/shell/functions | 2 +- .config/yadm/bootstrap | 2 ++ .local/bin/scripts/black | 5 +++++ .local/bin/scripts/netkeeper | 2 +- .local/bin/scripts/s | 4 +++- .local/bin/scripts/synctray | 3 ++- .local/bin/scripts/update-e2b | 2 +- 8 files changed, 18 insertions(+), 8 deletions(-) create mode 100755 .local/bin/scripts/black diff --git a/.bash_aliases b/.bash_aliases index b782763..4d61220 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -6,7 +6,7 @@ alias sc="$sudo systemctl" alias scs="$sudo systemctl status" alias sce="$sudo systemctl enable --now" 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"; } status() { @@ -28,8 +28,8 @@ status() { fi } -alias u='$sudo apt update && sudo apt upgrade' -alias ur='u && $sudo reboot' +alias u="$sudo apt update && $sudo apt upgrade" +alias ur="u && $sudo reboot" # Diff recursively difr() { diff --color=always --unified=1 --recursive "$@" | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen; } diff --git a/.config/shell/functions b/.config/shell/functions index b9fad81..4678c7d 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -482,7 +482,7 @@ killJava() { which exa >/dev/null && 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 then fn() { $(command -v fd || echo fdfind) --hidden --no-ignore-vcs --one-file-system "$@" | less -F; } # [F]ind [n]o ignore diff --git a/.config/yadm/bootstrap b/.config/yadm/bootstrap index 448d586..e027118 100755 --- a/.config/yadm/bootstrap +++ b/.config/yadm/bootstrap @@ -155,3 +155,5 @@ subhighlight "Setup kakoune plugin loader" cloneshallow plug.kak robertmeta "$XDG_CONFIG_HOME/kak/plugins/plug.kak" touch $HOME/.local/state/wget-hsts + +dasht-docsets-install haskell rails_4 >/dev/null diff --git a/.local/bin/scripts/black b/.local/bin/scripts/black new file mode 100755 index 0000000..54b8a2a --- /dev/null +++ b/.local/bin/scripts/black @@ -0,0 +1,5 @@ +#!/bin/sh -e +# Suspend screen until enter is pressed +xset dpms force off +read +xset dpms force on diff --git a/.local/bin/scripts/netkeeper b/.local/bin/scripts/netkeeper index 617055c..d99c9ed 100755 --- a/.local/bin/scripts/netkeeper +++ b/.local/bin/scripts/netkeeper @@ -6,8 +6,8 @@ if test -e "$JOURNAL"; then do read intention done jrnl intentions "$intention" - apprise $(pass service/apprise/intentions) -t 'janeks intention' -b "$intention" 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 #expr \( "$1" \> 40 \) \* 10 \| "$1" + apprise $(pass service/apprise/intentions | head -1) -t 'janeks intention' -b "$intention" fi diff --git a/.local/bin/scripts/s b/.local/bin/scripts/s index 8831a6a..a853ac0 100755 --- a/.local/bin/scripts/s +++ b/.local/bin/scripts/s @@ -1,7 +1,9 @@ #!/bin/sh # shows size statistics for subfolders # 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 ([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) diff --git a/.local/bin/scripts/synctray b/.local/bin/scripts/synctray index 2b7bb0e..551ceb2 100755 --- a/.local/bin/scripts/synctray +++ b/.local/bin/scripts/synctray @@ -1,5 +1,6 @@ #!/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 suffix=$1 yay --noconfirm -Syy --nobatchinstall boost c++utilities$suffix qtforkawesome$suffix qtutilities$suffix diff --git a/.local/bin/scripts/update-e2b b/.local/bin/scripts/update-e2b index 8b92e73..0e7002a 100755 --- a/.local/bin/scripts/update-e2b +++ b/.local/bin/scripts/update-e2b @@ -13,7 +13,7 @@ case $1 in esac test $# -eq 0 || $cmd -vi "$@" "$dir/LINUX" 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) sudo umount $drive sudo udefrag $drive