X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc;h=138fd896b26df6b2ae9361ba75709abd9855fe93;hb=103a2e153f844343c359882079936b2521c82f15;hp=c9cd4fcee4af66f81029ec406f6007de50d9ae0a;hpb=ea108a03dfa2d7f73447c0b14210d766e5ee5d9b;p=distro-setup diff --git a/brc b/brc index c9cd4fc..138fd89 100644 --- a/brc +++ b/brc @@ -466,6 +466,10 @@ c() { } ccomp cd c +bwm() { + s bwm-ng -T avg -d +} + b() { local topb if (( ${#_iankdirb[@]} == 0 )); then @@ -683,7 +687,7 @@ chrbind() { chumount() { local d # dev/pts needed for pacman signature check - for d in dev proc sys dev/pts; do + for d in dev/pts dev proc sys; do [[ -d $d ]] if mountpoint $d &>/dev/null; then m s umount $d @@ -779,6 +783,19 @@ despace() { done } +# get ipv4 ip from HOST. or if it is already a number, return that +hostip() { + local host="$1" + case $host in + [0-9:]) + echo "$host" + ;; + *) + getent ahostsv4 "$host" | awk '{ print $1 }' | head -n1 + ;; + esac +} + dig() { command dig +nostats +nocmd "$@" } @@ -816,7 +833,10 @@ digdiff() { dt() { date "+%A, %B %d, %r" "$@" } -ccomp date dt +dtr() { + date -R "$@" +} +ccomp date dt dtr dus() { # du, sorted, default arg of du -sh ${@:-*} | sort -h @@ -824,7 +844,7 @@ dus() { # du, sorted, default arg of ccomp du dus -e() { echo "$@"; } +e() { printf "%s\n" "$*"; } # echo args ea() { @@ -860,7 +880,11 @@ ediff() { etail() { tail -F /var/log/exim4/mainlog -n 200 "$@" } -ccomp tail etail +etail2() { + tail -F /var/log/exim4/mymain -n 200 "$@" +} + +ccomp tail etail etail2 # print exim old pids eoldpids() { @@ -920,14 +944,18 @@ eless() { } ccomp less eless eqcat() { - exiqgrep -i -o 60 | while read -r i; do + exiqgrep -ir.\* -o 60 | while read -r i; do hlm exim -Mvc $i echo hlm exigrep $i /var/log/exim4/mainlog | cat ||: done } eqrmf() { - exiqgrep -i | xargs exim -Mrm + # other ways to get the list of message ids: + # exim -bp | awk 'NF == 4 {print $3}' + # # this is slower 160ms, vs 60. + # exipick -i + exiqgrep -ir.\* | xargs exim -Mrm } econfdevnew() { @@ -960,6 +988,14 @@ faf() { # find all files. use -L to follow symlinks -o -name .undo-tree-history -prune \) -type f 2>/dev/null } +# full path without resolving symlinks +fp() { + local dir base + base="${1##*/}" + dir="${1%$base}" + printf "%s/%s\n" $(cd $dir; pwd) "$base" +} + # mail related frozen() { @@ -1371,7 +1407,15 @@ nags() { } nmt() { - s nmtui-connect "$@" + # cant use s because sudo -i doesnt work for passwordless sudo command + case $EUID in + 0) + sudo nmtui-connect "$@" + ;; + *) + nmtui-connect "$@" + ;; + esac } nopanic() { @@ -1539,7 +1583,7 @@ resolvcat() { grep '^ *hosts:' /etc/nsswitch.conf if systemctl is-enabled systemd-resolved &>/dev/null || [[ $(systemctl is-active systemd-resolved ||:) != inactive ]]; then hr; m ser status systemd-resolved | cat || : - hr; m systemd-resolve --status | cat + hr; m resolvectl status | cat fi } @@ -1696,7 +1740,7 @@ sk() { local quotes others quotes=2048,2068,2086,2206 - others=2029,2033,2164 + others=2029,2033,2054,2164 shellcheck -W 999 -x -e $quotes,$others "$@" || return $? }