mostly profanity and fixes
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index 108be387fd24cf1a1d9f697feaf66787a5601d81..bad1194baf610135693989e4eb8da56efee403de 100644 (file)
--- a/brc2
+++ b/brc2
@@ -1673,7 +1673,7 @@ bindpush() {
   dsign iankelling.org expertpathologyreview.com zroe.org amnimal.ninja
   lipush
   for h in li bk; do
-    m sl $h <<'EOF'
+    m sl $h.b8.nz <<'EOF'
 source ~/.bashrc
 m dnsup
 EOF
@@ -2169,7 +2169,7 @@ hstatus() {
 wlog() {
   local day i days_back
   days_back=${1:-16}
-  for (( i=0; i<days_back; i++ )); do
+  for (( i=days_back; i>=0; i-- )); do
     day=$( date +%F -d @$((EPOCHSECONDS - 86400*i )) )
     date "+%a %b %d" -d @$((EPOCHSECONDS - 86400*i )) | tr '\n' ' '
     /a/opt/timetrap/bin/t d -ftotal -s $day -e $day all -m '^w|lunch$'
@@ -2780,6 +2780,12 @@ myirc() {
 }
 
 
+allmyirc() {
+  local d
+  d=/var/lib/znc/moddata/log/iank/freenode
+  ssh root@iankelling.org "cd $d; find . -mtime -60 -type f -exec grep '\<iank.*' {} +" | sed -r 's,^..([^/]*)/(.{11})(.{5})(.{8}).,\2\4 \1,' | sort
+}
+
 # The way pidgin logs with xmpp (maybe related to running cheogram too)
 # is that there are sometimes duplicates, and sometimes the a log file
 # is for a specific day yet logs messages for subsequent days, and the
@@ -2792,19 +2798,61 @@ mypidgin() {
   c /p/c/.purple/logs/jabber/iank@fsf.org/office@conference.fsf.org.chat
   for x in *.html; do html2text -o ${x%.html}.txt $x; done;
   # shellcheck disable=SC2016 # false positive on ${
-  grep -A1 ') iank:' *.txt \
+  grep -A1 ') iank:' ./*.txt \
     | sed -r 's/^(.{10})[^ ]*\.txt:\(?([^ ]*)[[:space:]](..). iank:/\1_\2_\3/
 s/^[^ ]*\.txt-//
 /^--$/d
 s/^[^ ]*\.txt:\((.{2}).(.{2}).(.{4}) (.{8}) (.{2})\)?/\3-\1-\2_\4_\5/' \
     | sed -n 'x;1d;0~2{G;s/\n/ /;p};${x;p}'
 }
-allmyirc() {
-  local d
-  d=/var/lib/znc/moddata/log/iank/freenode
-  ssh root@iankelling.org "cd $d; find . -mtime -60 -type f -exec grep '\<iank.*' {} +" | sed -r 's,^..([^/]*)/(.{11})(.{5})(.{8}).,\2\4 \1,' | sort
+
+# my profanity
+#
+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 ))
+  else
+    i=0
+  fi
+  min_date=$(date -d 'monday 2 weeks ago' +%s)
+  for (( ; i < logcount; i++ )); do
+    log=${logs[$i]}
+    d=$(date -d "$(head -n1 $log|awk '{print $1}')" +%s)
+    if (( d < min_date )); then
+      continue
+    fi
+    if awk '$3 == "iank:"' $log | sed -r 's/^(.{10}).(.{8})[^ ]+(.*)/\1_\2\3/' | grep .; then
+      hr
+    fi
+  done
+  popd
 }
 
+# tail pms in the last day, for the case where we restart profanity and
+# didn't check for pms beforehand.
+profrecent() {
+  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)" )
+  for d in /d/p/profanity/chatlogs/iank_at_fsf.org/!(rooms); do
+    files=()
+    for date in ${dates[@]}; do
+      f=$d/$date.log
+      if [[ -e $f ]]; then
+        files+=($f)
+      fi
+    done
+    if (( ${#files[@]} >= 1 )); then
+      cat ${files[@]} | tail
+      hr
+    fi
+  done
+}
+
+
 # usage: debvm DEBIAN_VERSION RAM_MB
 debvm() {
   local ver ram fname src