+
+lp22viewers() {
+ v=0
+ roomv=(0 0)
+ rooms=(jupiter saturn)
+ for ip in 209.51.188.25 live.fsf.org; do
+ out=$(curl -sS --insecure https://$ip/)
+ for i in 0 1 2; do
+ room=${rooms[i]}
+ while read -r n; do
+ v=$((v+n))
+ # shellcheck disable=SC2004 # false positive
+ roomv[$i]=$(( ${roomv[$i]} + n ))
+ done < <(printf "%s\n" "$out" | grep -Po "$room.*?current[^0-9]*[0-9]*" | grep -o '[0-9]*$' )
+ done
+ done
+ printf "total: %s " $v
+ for i in 0 1; do
+ room=${rooms[i]}
+ printf "$room: %s " "${roomv[$i]}"
+ done
+ echo
+}
+
+arpflush() {
+ local default_route_dev
+ default_route_dev=$(ip r show default | sed 's/.*dev \([^ ]*\).*/\1/' | head -n1)
+ m s ip n flush dev "$default_route_dev"
+}
+
+dsh() {
+ command dsh -c "$@"
+}
+
+# cat or bat with color if we have it
+v() {
+ if type -t batcat >/dev/null; then
+ # note: another useful useful style is "header"
+ batcat --color always --style plain --theme Coldark-Cold -P "$@"
+ else
+ cat "$@"
+ fi
+}
+
+# Combine files $@ into a single file with comments between them which
+# allow splitting them back with fsplit.
+#
+# Assumes file names do not have newlines in them.
+fcomb() {
+ local f comment out
+ # generated with cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c8
+ comment='# jvvuyUsq '
+ out=~/fcomb
+ rm -f $out
+ for f; do
+ echo "$comment$f" >>$out
+ cat "$f" >>$out
+ done
+}
+fsplit() {
+ local f fin line fin_lines
+ fin=~/fcomb
+ line=1
+ fin_lines=$(wc -l "$fin" | awk '{print $1}')
+ comment='# jvvuyUsq '
+ while (( line <= fin_lines )); do
+ f=$(sed -n "${line}s/^$comment//p" "$fin")
+ sed -n "$line,/^$comment/{/^$comment/d;p}" "$fin" >"$f"
+ line=$(( line + 1 + $(wc -l "$f" | awk '{print $1}') ))
+ done
+}
+