From 6fae25b305d714b3ab7608fa003f1af9bf024545 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 14 Feb 2023 13:33:23 +0800 Subject: Rename tools into bin --- tools/sns/mastodon.sh | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100755 tools/sns/mastodon.sh (limited to 'tools/sns/mastodon.sh') diff --git a/tools/sns/mastodon.sh b/tools/sns/mastodon.sh deleted file mode 100755 index fb93bcd..0000000 --- a/tools/sns/mastodon.sh +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/bash - -# Restore mail in variable -MAIL="$(cat)" - -# Only execute the following script when mail receiver is mastodon@topo.tw -grep -qE "^X-Original-To: .*mastodon@topo.tw[>]?$" <<<"$MAIL" || exit 0 -# A little hacky way to check if mail is sent from me -sed -nE '/^Received: /p;/^$/q' <<<"$(MAIL)" | wc -l | xargs -i test {} -lt 2 || exit 0 - -# Leave log -date >>~/Downloads/mastodon.log -echo $$ >>~/Downloads/mastodon.log -awk -v RS= 'NR>1' <<<"$MAIL" >>~/Downloads/mastodon.log - -# Use toot to send message on g0v.social -awk -v RS= 'NR>1' <<<"$MAIL" | toot post >>/tmp/mastodon.log -- cgit v1.2.3-70-g09d2