From: Ian Kelling Date: Sun, 24 May 2026 03:09:08 +0000 (-0400) Subject: minor improvements X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=c0f03b1cbb756168c6bfb616be3e5c95224dce6f;p=distro-setup minor improvements --- diff --git a/brc b/brc index 19094f4..a767bc9 100644 --- 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 b3f1bf8..94aeb78 100644 --- 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 diff --git a/subdir_files/.config/konsolerc b/subdir_files/.config/konsolerc index 87c09bd..d4271cf 100644 --- a/subdir_files/.config/konsolerc +++ b/subdir_files/.config/konsolerc @@ -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