various updates
[distro-setup] / brc
diff --git a/brc b/brc
index fdd8e2cf73b6b564f94e185feb7e2192ea74eef7..138fd896b26df6b2ae9361ba75709abd9855fe93 100644 (file)
--- 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
@@ -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 "$@"
 }
@@ -827,7 +844,7 @@ dus() { # du, sorted, default arg of
 ccomp du dus
 
 
-e() { printf "%s\n" "$@"; }
+e() { printf "%s\n" "$*"; }
 
 # echo args
 ea() {
@@ -927,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() {
@@ -1386,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() {
@@ -1554,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
 
 }
@@ -1711,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 $?
 }