summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rwxr-xr-xsh/cgm34
-rwxr-xr-xsh/ggm13
3 files changed, 48 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index ce58481..9210ff0 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@
# For a command not to echo itself, prefix @ to the command
# https://unix.stackexchange.com/a/740226/459013
-SH = alarm backlight bell ccgp cfg chmodef curlqb dateft dirnameall gita gitfork gitmetap gitmetar gitpu grrc il lastarg loop lsp mll mmi mpra mpva mpvy mvln mvtr mvtu news o orgext pa pq px qg qw rate reco rfp sbar ta time-uuid topa upd vinfo wh wtr xmq prp vip vpn dnd
+SH = alarm backlight bell ccgp cfg chmodef curlqb dateft dirnameall gita gitfork gitmetap gitmetar gitpu grrc il lastarg loop lsp mll mmi mpra mpva mpvy mvln mvtr mvtu news o orgext pa pq px qg qw rate reco rfp sbar ta time-uuid topa upd vinfo wh wtr xmq prp vip vpn dnd cgm ggm
PACMAN_HOOKS = setcap-intel_gpu_top.hook setcap-iotop-c.hook setcap-nethogs.hook
PREFIX = /usr/local
diff --git a/sh/cgm b/sh/cgm
new file mode 100755
index 0000000..262ebb2
--- /dev/null
+++ b/sh/cgm
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Curl Gnu Mailman Mailing list archive
+# use with ggm
+
+# steal AGPL-3.0-only licensed code from https://code.librehq.com/ots/ots-tools/-/blob/main/search-mailman-archive
+
+# testing mailing list archives:
+# https://lists.zx2c4.com/pipermail/cgit/
+# https://mailman.nginx.org/pipermail/nginx/
+# only year:
+# https://dianne.skoll.ca/pipermail/remind-fans/
+
+# maybe need "${1%/}"
+url="$1"
+dir="$(basename "$1")_mail_archives"
+
+mkdir "$dir"
+
+# Then parse it to get links to all the gzipped archive files for
+# individual months.
+
+# only tested with monthly and yearly archives, not tested with quarterly
+for month in $(curl -L "$url" \
+ | awk -F'"' '/href="[0-9]{4,4}(-[[:alnum:]]+)?\.txt(\.gz)?">\[/{print $2}'); do
+ {
+ curl -s -L -o "$dir/$month" "$url/$month"
+ echo "Fetched $month..."
+ if [ "${month##*.}" = gz ]; then
+ gunzip "$dir/$month"
+ fi
+ } &
+done
+
+wait
diff --git a/sh/ggm b/sh/ggm
new file mode 100755
index 0000000..7bb66a4
--- /dev/null
+++ b/sh/ggm
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Grep Gnu Mailman Mailing list archive
+# use with cgm
+
+# testing mailing list archives:
+# https://lists.zx2c4.com/pipermail/cgit/
+# https://mailman.nginx.org/pipermail/nginx/
+# only year:
+# https://dianne.skoll.ca/pipermail/remind-fans/
+
+ls --zero | sort -zt- -k1,1n -k2,2.3M | xargs -0 grep -i --color=always "$@"
+# if want reverse sort, put r right after -k1,1n, more see `man sort`, e.g.:
+#ls --zero | sort -zt- -k1,1nr -k2,2.3Mr | xargs -0 grep -i --color=always "$@" | "$PAGER"