diff --git a/.bash_aliases b/.bash_aliases index d45ca96..b782763 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -1,10 +1,35 @@ test -n "$PS1" || return 0 -alias sc="sudo systemctl" -alias scs="sudo systemctl status" -alias sce="sudo systemctl enable --now" -alias scr="sudo systemctl reload-or-restart" -alias status="sudo systemctl list-units --failed || service --status-all; tmux ls; sudo docker ps || sudo systemctl status docker" +test $(id -u) -eq 0 || sudo=sudo + +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" + +highlight() { echo "$1"; } +status() { + highlight 'System' + free -h + df -h -T --exclude-type=tmpfs --exclude-type=devtmpfs --exclude-type=squashfs --exclude-type=overlay + zfs list -d 0 + highlight 'Internet' + #--color=always + ip -brief address | grep --color=none -E '^(wl|en|tun|vmbr)' + ip route + echo -n 'IPv4: ' && timeout 3s ping example.com -A -c 3 -w 3 -q -4 + echo -n 'IPv6: ' && timeout 3s ping example.com -A -c 3 -w 3 -q -6 + highlight 'Programs' + tmux ls + $sudo systemctl --no-pager list-units --failed || service --status-all + if type docker >/dev/null + then $sudo docker ps || $sudo systemctl status docker + fi +} + +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/jrnl/jrnl.yaml##template b/.config/jrnl/jrnl.yaml##template index 4f48cfb..a44927e 100644 --- a/.config/jrnl/jrnl.yaml##template +++ b/.config/jrnl/jrnl.yaml##template @@ -12,7 +12,7 @@ indent_character: '|' journals: default: ~/data/2-box/journal/jrnl.txt intentions: ~/data/2-box/journal/intentions.txt - nug: ~/data/2-box/journal/nugnug.txt + nug: ~/data/2-box/journal/nug.txt linewrap: 99 tagsymbols: '@' template: false diff --git a/.config/shell/functions b/.config/shell/functions index ee35d48..82c7757 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -316,10 +316,15 @@ sshl() { local authcache="/var/tmp/ssh-keys" mkdir -p "$authcache" local file="$authcache/$1" + ssh -G "$1" | grep --silent "^user root$" && + ! [[ "$1" =~ "pve.*" ]] && + ! [[ "$1" =~ "encee.*" ]] && + ! [[ "$1" =~ ".*fmh.de" ]] && + pass=pass test "$all" && - pass scp ~/.bash_aliases "$1:" && - pass ssh "$1" 'grep -q ".bash_aliases" .bashrc || echo "source ~/.bash_aliases" >>.bashrc' - if ssh -G "$1" | grep --silent "^user root$" && ! [[ "$1" =~ "pve*" ]] + $pass scp ~/.bash_aliases "$1:" && + $pass ssh "$1" 'grep -q ".bash_aliases" .bashrc || echo "source ~/.bash_aliases" >>.bashrc' + if test -n "$pass" then pass ssh "$@" else test ! -e "$file" && diff --git a/.local/bin/scripts/autolight b/.local/bin/scripts/autolight new file mode 100755 index 0000000..48bcb7e --- /dev/null +++ b/.local/bin/scripts/autolight @@ -0,0 +1,7 @@ +#!/bin/sh -e +# Automatically set screen brightness based on time of day. +# OLD: value=$(expr 100 - $(expr 13 - $(date +%H) | tr -d -) \* 5) +# S Function: echo "(c($(date +%H) / 4 - 3) + 1) * 50" | bc -l +value=$(echo "l=(100 - 1.5 * ( 11 - $(date +%H) ) ^ 2); if(l > 0) l else 3" | bc -l) +light -S $value +{ date && echo $value; } >>/var/log/autolight