mostly improvements, wip
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index 5fde3685ef65a65997aa6542cce52a87ae69f3cb..7699add59555e0dcb824686d4ee2835c12dd0867 100644 (file)
--- a/brc2
+++ b/brc2
@@ -441,7 +441,7 @@ ralerts() { # remote alerts
 ap() {
   # pushd in case current directory has an ansible.cfg file
   pushd /a/xans >/dev/null
-  ansible-playbook -v -l ${1:- $(hostname -f)} site.yml
+  ansible-playbook -v -i ${1:- $(hostname -f)}, site.yml
   popd >/dev/null
 }
 aw() {
@@ -1682,11 +1682,9 @@ jdo() {
   if [[ $cmd != /* ]]; then
     cmd=$(type -P "$cmd")
   fi
+  #note date format for since is date '+%F %T'
   # -q = quiet
-  journalctl -qn2 -f -u "$cmd_name" &
-  # Trial and error of time needed to avoid missing initial lines.
-  # .5 was not reliable. 1 was not reliable. 2 was not reliable
-  sleep 4
+  journalctl --since=now -qn2 -f -u "$cmd_name" &
   jr_pid=$!
   # note, we could have a version that does system --user, but if for example
   # it does sudo ssh, that will leave a process around that we can't kill
@@ -2963,7 +2961,7 @@ EOF
   done | s cedit -e hosts-file-up /etc/hosts
   for host in ${hosts[@]}; do
     echo $host
-  done | cedit -e /a/bin/ds/subdir_files/.dsh/group/btrbk
+  done >/p/c/subdir_files/.dsh/group/btrbk
   ### end focus on hosts file update ###
 
 
@@ -3384,8 +3382,8 @@ myprof() {
   pushd /home/iank/.local/share/profanity/chatlogs/iank_at_fsf.org/rooms/office_at_conference.fsf.org
   logs=(*)
   logcount=${#logs[@]}
-  if (( logcount > 15 )); then
-    i=$(( logcount - 15 ))
+  if (( logcount > 16 )); then
+    i=$(( logcount - 16 ))
   else
     i=0
   fi
@@ -4177,10 +4175,7 @@ vpn() {
   fi
 
   [[ $1 ]] || { echo need arg; return 1; }
-  journalctl --unit=$vpn_service@$1 -f -n0 &
-  # sometimes the journal doesnt open until after the vpn output
-  # has happened. hoping this fixes that.
-  sleep 1
+  journalctl --since=now --unit=$vpn_service@$1 -f -n0 &
   sudo systemctl start $vpn_service@$1
   # sometimes the ask-password agent does not work and needs a delay.
   sleep .5
@@ -4199,15 +4194,17 @@ fixu() {
   fi
 }
 
-# unmute
+# unmute desktop output
 um() {
-  local sink card
+  local sink card sedcmd
   sink=$(pactl get-default-sink)
   if [[ $sink == auto_null ]]; then
     # guessing there is just one with an off profile. otherwise we will
     # need some other solution, like storing the card identifier that we
-    # muted with nap.
-    card=$(pacmd list-cards | sed -n '/^[[:space:]]*index:/{s/^[[:space:]]*index://;h};/^[[:space:]]*active profile: <off>$/{g;p;q}')
+    # muted with nap. Or, we could so some hakery with
+    # pactl -f json.
+    sedcmd='/^[[:space:]]*index:/{s/^[[:space:]]*index://;h};/^[[:space:]]*active profile: <off>$/{g;p;q}'
+    card=$(pacmd list-cards | sed -n "$sedcmd")
     m pacmd set-card-profile "$card" output:analog-stereo
   fi
 
@@ -4725,7 +4722,8 @@ ftoc() {
   units "tempF($1)" tempC
 }
 
-# requires dns/firewall setup first
+# note: requires dns setup of live.iankelling.org, & if i'm home, port
+# forwarding in wrt-setup-local.  todo: automate that.
 local-icecast() {
   web-conf -e ian@iankelling.org -f 8000 - apache2 live.iankelling.org  <<'EOF'
 <Location "/fsf.webm">
@@ -4776,6 +4774,27 @@ opensslcertinfo() {
   openssl x509 -txt -in "$@"
 }
 
+# dsh on btrbk hosts
+dsb() {
+  :
+}
+
+# dsh a file and run it
+dsa() {
+  local ret file
+  if ! parallel -j 10 scp x {}:/tmp <~/.dsh/group/btrbk; then
+    echo parallel scp failed. dsa returning $ret
+  fi
+  dsh -g btrbk
+}
+
+# temporary
+zmqsend() {
+  /nocow/t/ffmpeg-release/ffmpeg-7.0.1/tools/zmqsend "$@"
+}
+
+ffg() { /nocow/t/ffmpeg-release/ffmpeg-7.0.1/tools/graph2dot -o /tmp/g.tmp && dot -Tpng /tmp/g.tmp -o /tmp/g.png && feh /tmp/g.png; }
+
 export BASEFILE_DIR=/a/bin/fai-basefiles
 
 #export ANDROID_HOME=/a/opt/android-home