minor improvements
authorIan Kelling <ian@iankelling.org>
Sun, 24 May 2026 03:09:08 +0000 (23:09 -0400)
committerIan Kelling <ian@iankelling.org>
Sun, 24 May 2026 03:09:08 +0000 (23:09 -0400)
brc
brc2
subdir_files/.config/konsolerc

diff --git a/brc b/brc
index 19094f4cc3598a593d85242db8f95017e59d4626..a767bc911686e9834fd5c91f6cee0e8e7cd2834e 100644 (file)
--- a/brc
+++ b/brc
@@ -2819,7 +2819,7 @@ r() {
   #  exit "$@" 2>/dev/null
 }
 
-# Like sed -i, but running whatever command you want with sponge.
+# Like sed -i ... FILE, but running whatever command you want with sponge.
 ri() {
   # shellcheck disable=SC2124 # false positive
   local file="${@: -1}" # last arg
@@ -4110,18 +4110,24 @@ if [[ $- == *i* ]]; then
       if history -a; then
         # If are sshed to HOST2, our history will get overwritten after
         # syncing with HOST2 so don't bother.
-        if [[ $SSH_CLIENT && $HOST2 != "$HOSTNAME" && $LC_USEBASHRC == sl_* && -w /tmp/S.$LC_USEBASHRC ]]; then
+        if [[ $SSH_CLIENT && $HOST2 != "$HOSTNAME" && $LC_USEBASHRC == sl_* && ${_sl_hist_cmd[0]} != none && -w /tmp/S.$LC_USEBASHRC ]]; then
           if [[ $_did_ssh_prompt1 ]]; then
-            h="$(history 1)"
+            h="$(history 1 | sed -r 's/^ *([^ ]+ +){4}//')"
+            if [[ ! -v _sl_hist_cmd ]]; then
+              # in trisquel, netcat-traditional does not support -U.
+              if type -p nc &>/dev/null && nc -h |& grep -Eq '^[[:space:]]*-U'; then
+                _sl_hist_cmd=(nc -w 1 -U "/tmp/S.$LC_USEBASHRC")
+              elif type -p socat &>/dev/null; then
+                _sl_hist_cmd=(socat STDIO "UNIX-CONNECT:/tmp/S.$LC_USEBASHRC")
+              else
+                _sl_hist_cmd=(none)
+              fi
+            fi
             # note: _sl_last_history is to avoid wastefully sending
             # history which won't actually get saved.
             if [[ $h != "$_sl_last_history" && $h =~ $cmd_regex  ]]; then
               _sl_last_history="$h"
-              if type -p socat &>/dev/null; then
-                sed -r 's/^ *([^ ]+ +){4}//' <<<"$h" | (socat - UNIX-CONNECT:/tmp/S.$LC_USEBASHRC &)
-              elif type -p nc &>/dev/null; then
-                sed -r 's/^ *([^ ]+ +){4}//' <<<"$h" |  (nc -w 1 -U /tmp/S.$LC_USEBASHRC &)
-              fi
+              ("${_sl_hist_cmd[@]}" <<<"$h" &)
             fi
           else
             _sl_last_history="$(history 1)"
@@ -4989,6 +4995,16 @@ pidw() {
 # printf string + newline
 pn() { printf '%s\n' "$@"; }
 
+# loc = lines of code. nonverbose. Ignores dirs, so, loc *, or loc **.
+#
+loc() {
+  local arg
+  for arg; do
+    [[ -s $arg && -f $arg ]] || continue
+    printf "%8s  %s\n" "$(cloc --json "$arg"|jq '.SUM.code')" "$arg"
+  done | sort -n
+}
+
 # * stuff that makes sense to be at the end
 
 # note, if we unset IFS, that will mess up completion scripts which
diff --git a/brc2 b/brc2
index b3f1bf8c78fc0c4d349669adaff4a81bab611fe4..94aeb78bef7c4ccabe98c3c3222e9e53906577da 100644 (file)
--- a/brc2
+++ b/brc2
@@ -3873,9 +3873,12 @@ vpncmd() {
 vpncmdroot() {
   sdncmdroot wg-quick-tr@client.service "$@"
 }
+# usage: vpni [suffix]
+# suffix selects non-default vpn.
+# shellcheck disable=SC2120 # expected
 vpni() {
   # m sudo nsenter --net=/var/run/netns/client sudo -u iank -i bash # for just the netns
-  sdncmd wg-quick-tr@client.service bash
+  sdncmd wg-quick-tr@client$1.service bash
 }
 vpnbash() {
   #m sudm nsenter --net=/var/run/netns/client bash # only gets netns
index 87c09bdf6016e9b321c2458cb9751473b7bf40c6..d4271cfed13a3e11fb457f408743d6861f503b95 100644 (file)
@@ -23,10 +23,10 @@ ShowMenuBarByDefault=false
 2 screens: Width=1916
 2 screens: XPosition=2
 2 screens: YPosition=2
-3840x2160 screen: Height=1076
-3840x2160 screen: Width=1393
-3840x2160 screen: XPosition=2
-3840x2160 screen: YPosition=1082
+3840x2160 screen: Height=2156
+3840x2160 screen: Width=1276
+3840x2160 screen: XPosition=1409
+3840x2160 screen: YPosition=2
 DP-0=DP-0
 DP-1 eDP-1=DP-1
 DP-1-1 eDP-1=DP-1-1