X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc2;h=15f953909b6e2f790c28761d9053400c6a82260a;hb=2ff8740f1061a31683152a4447340921de82b1b9;hp=bad1194baf610135693989e4eb8da56efee403de;hpb=768363d8771edb9d9ed82425fa772d77b90139c0;p=distro-setup diff --git a/brc2 b/brc2 index bad1194..15f9539 100644 --- a/brc2 +++ b/brc2 @@ -71,6 +71,8 @@ source /a/bin/ds/beet-data # * functions + + multimic() { local i local -a sources @@ -674,6 +676,7 @@ beetag-nostatus() { fi if $erasable_line; then # https://stackoverflow.com/a/71286261 + # erase line / delete line in terminal printf '\033[1A\033[K' fi erasable_line=false @@ -1189,7 +1192,7 @@ beet2nav() { # pull in beets library locally beetpull() { - local sshfs_host + local sshfs_host sshfs_cmd sshfs_host=b8.nz if [[ $HOSTNAME == kd ]]; then return 0 @@ -1198,8 +1201,9 @@ beetpull() { s mkdir /i s chown iank:iank /i fi - if ! mountpoint /i &>/dev/null; then - m sshfs $sshfs_host:/i /i + sshfs_cmd="sshfs -o ServerAliveInterval=15,reconnect $sshfs_host:/i /i" + if ! pgrep -f "^$sshfs_cmd$" >/dev/null; then + m $sshfs_cmd fi } @@ -2141,7 +2145,7 @@ gpg() { } gse() { - local email=ian@iankelling.org + local email=iank@fsf.org git send-email --notes "--envelope-sender=<$email>" \ --suppress-cc=self "$@" } @@ -2817,7 +2821,12 @@ myprof() { else i=0 fi - min_date=$(date -d 'monday 2 weeks ago' +%s) + # usually do this on monday, sometimes later + if [[ $(date +%A) == Monday ]]; then + min_date=$(date -d 'monday 2 weeks ago' +%s) + else + min_date=$(date -d 'monday 3 weeks ago' +%s) + fi for (( ; i < logcount; i++ )); do log=${logs[$i]} d=$(date -d "$(head -n1 $log|awk '{print $1}')" +%s) @@ -2831,12 +2840,24 @@ myprof() { popd } -# tail pms in the last day, for the case where we restart profanity and -# didn't check for pms beforehand. -profrecent() { +# Tail pms in the last day, for the case where we restart profanity and +# didn't check for pms beforehand. Assume the most recent logs are on kd. +# If that isn't the case, use prof-recent-local +prof-recent() { + case $HOSTNAME in + kd) + prof-recent-local + ;; + *) + ssh b8.nz prof-recent-local + ;; + esac +} + +prof-recent-local() { local d dates date files f # consider making the day count passed by parameter. note: this works: $(date -d '2 day ago' +%Y_%m_%d) - dates=("$(date -d +%Y_%m_%d)" "$(date -d '1 day ago' +%Y_%m_%d)" ) + dates=("$(date +%Y_%m_%d)" "$(date -d '1 day ago' +%Y_%m_%d)" ) for d in /d/p/profanity/chatlogs/iank_at_fsf.org/!(rooms); do files=() for date in ${dates[@]}; do @@ -3289,9 +3310,12 @@ testexim() { # # -t = get recipient from header exim -d -t </dev/null | grep -iP --color=auto -- "$*" ||: + rgv -- "$*" $paths /a/t.org /p/w.org /a/work.org ||: +} +reml() { # with limit to 5 matches per file local paths paths="/p/c /b" find $paths -not \( -name .svn -prune -o -name .git -prune \ @@ -3948,6 +3980,34 @@ path-add --end --ifexists $HOME/.rvm/bin # so its included in overall env +# ya, hacky hardcoded hostnames in 2023. we could do better +hssh-update() { + local -a failed_hosts hosts + case $HOSTNAME in + sy|kd) + hosts=( + kd x3.office.fsf.org syw + ) + ;; + x3) + hosts=( + b8.nz sywg.b8.nz + ) + ;; + esac + for host in ${hosts[@]}; do + e $host + if ! scp /b/fai/fai/config/files/usr/local/bin/hssh/IANK root@$host:/usr/local/bin/hssh; then + failed_hosts+=($host) + fi + done + if (( ${#failed_hosts[@]} >= 1 )); then + echo failed_hosts=${failed_hosts[*]} + return 1 + fi +} + + export BASEFILE_DIR=/a/bin/fai-basefiles #export ANDROID_HOME=/a/opt/android-home