mainly new feature to intentionally delay sending email
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index 23cfd89aa14b5f1342229ca97acbf9abcf4b9eca..1974c580b867ea432b9cff6b42664080888f9087 100644 (file)
--- a/brc2
+++ b/brc2
@@ -289,14 +289,41 @@ tback() {
 # sshfs example:
 # s sshfs bu@$host:/bu/home/md /bu/mnt -o reconnect,ServerAliveInterval=20,ServerAliveCountMax=30 -o allow_other
 
+edelayoff() {
+  echo all >/etc/exim4/no-delay-eximids
+}
+edelayon() {
+  echo >/etc/exim4/no-delay-eximids
+}
+
 eqgo() {
-  local -a array tmpstr
+  local -a array tmpstr delayon
+  delayon=true
+  if grep -qFx all /etc/exim4/no-delay-eximids; then
+    delayon=false
+  fi
+  if $delayon; then
+    echo all >/etc/exim4/no-delay-eximids
+  fi
   tmpstr=$(exiqgrep -i -r.\*)
   mapfile -t array <<<"$tmpstr"
   enn -M "${array[@]}"
+  if $delayon; then
+    echo >/etc/exim4/no-delay-eximids
+  fi
 }
 eqgo1() {
-  enn -M "$(exipick -i -r.\*|h1)"
+  local eid
+  eid="$(exipick -i -r.\*|h1)"
+  sed -n "/^all$/p;\$a $eid" /etc/exim4/no-delay-eximids
+  enn -M "$eid"
+}
+ennm() {
+  local eid
+  for eid; do
+    printf "%s\n" "$eid" >>/etc/exim4/no-delay-eximids
+  done
+  enn -M "$@"
 }
 
 
@@ -2751,11 +2778,21 @@ myirc() {
   # use * instead of -r since that does sorted order
   ssh root@iankelling.org "for f in ${d[*]}; do cd \$f/#$1; grep '\<iank.*' *; done" | cut --complement -c12-16
 }
+
+
+# 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
+# only way to realize that is to notice that the timestamps rolled over
+# into a new day, you can't see it in isolation. So, basically, pidgin
+# logs are really annoying to read a grep of my messages to find the
+# date and time I said when I started and stopped working, so I'm trying
+# out a new client: profanity.
 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
@@ -3292,7 +3329,7 @@ enn() {
     s $ecmd "$@"
     return
   fi
-  pid=$(pgrep -f "/usr/sbin/exim4 -bd -q30m -C /etc/exim4/my.conf"|h1)
+  pid=$(pgrep -f "/usr/sbin/exim4 -bd -q10m -C /etc/exim4/my.conf"|h1)
   m s nsenter -t $pid -n -m $ecmd "$@"
 }
 
@@ -3371,7 +3408,7 @@ mailnnbash() {
 
 eximbash() {
   local pid
-  pid=$(pgrep -f "/usr/sbin/exim4 -bd -q30m -C /etc/exim4/my.conf"|h1)
+  pid=$(pgrep -f "/usr/sbin/exim4 -bd -q10m -C /etc/exim4/my.conf"|h1)
   if [[ ! $pid ]]; then
     echo "eximbash: failed to find exim pid. systemctl -n 30 status exim4:"
     systemctl status exim4
@@ -3630,8 +3667,8 @@ rem() {
   paths="/p/c /b"
   find $paths -not \( -name .svn -prune -o -name .git -prune \
        -o -name .hg -prune -o -name .editor-backups -prune \
-       -o -name .undo-tree-history -prune \) 2>/dev/null | grep -iP --color=auto "$*" ||:
-  rgv -m 5 "$*" $paths /a/t.org /p/w.org /a/work.org ||:
+       -o -name .undo-tree-history -prune \) 2>/dev/null | grep -iP --color=auto -- "$*" ||:
+  rgv -m 5 -- "$*" $paths /a/t.org /p/w.org /a/work.org ||:
 }
 
 # setup:
@@ -3827,6 +3864,14 @@ amoffice() {
 amls() {
   amall silence query "$@"
 }
+# amtool silence add
+amsa() {
+  amall silence add "$@"
+}
+# amtool silence force
+amsf() {
+  amall silence add x!="1"
+}
 amrmall() {
   # note: not sure if quoting of this arg is correct
   amfsf silence expire "$(amfsf silence query -q)"
@@ -3842,12 +3887,12 @@ youtube-dl-update() {
 # https://github.com/yt-dlp/yt-dlp/wiki/Installation
 yt-dlp-update() {
   sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
-sudo chmod a+rx /usr/local/bin/yt-dlp  # Make executable
-  }
+  sudo chmod a+rx /usr/local/bin/yt-dlp  # Make executable
+}
 
 mpvyt() {
   mpv --ytdl ytdl_path=/usr/local/bin/yt-dlp "$@"
-  }
+}
 
 # taken from default changes to bashrc and bash_profile
 path-add --end --ifexists $HOME/.rvm/bin