aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-06-03 20:12:49 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-06-03 20:12:49 +0200
commit5b9ff2c334a3a85c25b11bc17009f211eec51575 (patch)
treeff8d82f8a952e6f3006aec99a758f10a5592e74a
parentf0b527f61e251a879a179ff4fef16baaa486c047 (diff)
downloadscripts-5b9ff2c334a3a85c25b11bc17009f211eec51575.tar.gz
scripts-5b9ff2c334a3a85c25b11bc17009f211eec51575.tar.bz2
scripts-5b9ff2c334a3a85c25b11bc17009f211eec51575.zip
update
-rwxr-xr-xpw-biff25
-rwxr-xr-xpw-update-fingerprint16
2 files changed, 41 insertions, 0 deletions
diff --git a/pw-biff b/pw-biff
new file mode 100755
index 0000000..40265e4
--- /dev/null
+++ b/pw-biff
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+# run from cron
+
+if [ -z $1 ]; then
+ exit
+fi
+
+export DISPLAY=:0.0
+export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
+
+maildir="$HOME/.mail/$1/Inbox/new/"
+
+mailcount=$(find $maildir -type f | wc -l)
+
+if (("$mailcount" > 0)); then
+
+ /usr/local/bin/dunstify \
+ -t 5000 \
+ -a "You have mail" \
+ -u normal \
+ -i internet-mail-symbolic \
+ -h string:x-dunst-stack-tag:Mail "$1 has mail: $mailcount messages"
+
+fi
diff --git a/pw-update-fingerprint b/pw-update-fingerprint
new file mode 100755
index 0000000..e25a0b4
--- /dev/null
+++ b/pw-update-fingerprint
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# update tls_fingerprint entry in ~/.msmtprc
+
+MAILSERVER="mail.server.com"
+PORT="587"
+
+cd $HOME
+
+# get the server fingerprint
+KEY=$(msmtp --serverinfo --tls --tls-certcheck=off --host="$MAILSERVER" --port="$PORT" | grep -E -o "([0-9A-Za-z]{2}:){31}[0-9A-Za-z]{2}")
+
+# replace tls_fingerprint line in .msmtprc
+sed -i "s/^tls_fingerprint.*/tls_fingerprint $KEY/g" .msmtprc
+
+echo ".msmtprc has been updated with the latest $MAILSERVER fingerprint."