config/shell: adjust helpers

This commit is contained in:
xeruf 2023-08-07 19:59:11 +02:00
parent 620c68f35f
commit 912116b9be
2 changed files with 9 additions and 3 deletions

View File

@ -266,10 +266,11 @@ curlh() {
unalias u 2>/dev/null # for bash unalias u 2>/dev/null # for bash
u() { u() {
# Line below handy for users of netkeeper # Line below handy for users of netkeeper
sudo nft list ruleset | grep -q outall && echo "Suspending netkeeper" >&2 | echo 'pausing netkeeper for sysupgrade' | netkeeper 30 2>/dev/null #sudo nft list ruleset | grep -q outall && echo "Suspending netkeeper" >&2 | echo 'pausing netkeeper for sysupgrade' | netkeeper 30 2>/dev/null
if command -v pacman >/dev/null; then if command -v pacman >/dev/null; then
if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)" if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)"
then then
# TODO or if location changed significantly or very slow
if command -v pacman-mirrors >/dev/null if command -v pacman-mirrors >/dev/null
then sudo pacman-mirrors --geoip then sudo pacman-mirrors --geoip
else sudo touch /etc/pacman.d/mirrorlist else sudo touch /etc/pacman.d/mirrorlist
@ -424,7 +425,10 @@ dic() {
alias dict="rlwrap rdictcc --directory $DICT" alias dict="rlwrap rdictcc --directory $DICT"
dict_update() { dict_update() {
local dictfile="$DICT/dict.txt" local dictfile="$DICT/dict.txt"
test $# -gt 0 && mv -v $1 "$dictfile" test $# -gt 0 && case "$1" in
(*.zip) dir=$(mktemp -d) && unzip "$1" -d "$dir" && mv -v $dir/* "$dictfile" && rm -v "$1";;
(*) mv -v "$1" "$dictfile";;
esac
echo "Reading in $dictfile..." echo "Reading in $dictfile..."
unbuffer rdictcc --directory $DICT -i "$dictfile" | rewrite unbuffer rdictcc --directory $DICT -i "$dictfile" | rewrite
} }
@ -440,7 +444,7 @@ npm-reinstall() {
alias onkyo='bluetoothctl disconnect 00:09:B0:1D:DC:98 && sleep 1 && bluetoothctl connect 00:09:B0:1D:DC:98' alias onkyo='bluetoothctl disconnect 00:09:B0:1D:DC:98 && sleep 1 && bluetoothctl connect 00:09:B0:1D:DC:98'
alias pdfcon='TEXMF="" pdfjam -o $(date +%F).pdf' alias pdfcon='TEXMF="" pdfjam -o $(date +%F).pdf'
alias pdfwor='TEXMF="" pdfjam -o collections/$(date +%F)_Akkorde.pdf' alias pdfwor='TEXMF="" pdfjam -o $(test -d "collections" && echo "collections/")$(date +%F)_Akkorde.pdf'
# Custom tools {{{1 # Custom tools {{{1

View File

@ -15,6 +15,8 @@ alias graphics='lspci -vnn | grep VGA --color=never && xrandr --listproviders'
alias clip='cliphist list | fzf | cliphist decode | wl-copy' alias clip='cliphist list | fzf | cliphist decode | wl-copy'
alias rotate='noglob swaymsg output * transform 270'
# WIP Edit mozilla config # WIP Edit mozilla config
mozedit() ( mozedit() (
set -eo pipefail set -eo pipefail