From: Andrew Lorimer Date: Thu, 10 Jan 2019 23:54:19 +0000 (+1100) Subject: Merge branch 'master' of ssh://charles/tank/andrew/code/scripts X-Git-Url: https://git.lorimer.id.au/scripts.git/diff_plain/6a282f177dc53ae17f19d5935a57ae987b1db9a0?hp=5f79131543c9ca9c8833883f6146285ab0217df4 Merge branch 'master' of ssh://charles/tank/andrew/code/scripts --- diff --git a/nameget.sh b/nameget.sh index edc1e2e..b083568 100755 --- a/nameget.sh +++ b/nameget.sh @@ -28,11 +28,15 @@ otherargs=$@ # set aside remaining arguments for passing to wget logger -s -t $LOGTAG "starting downloading files in $list" while read -r url filename; do - if wget --cut-dirs=100 -np -e robots=off -O $outdir$filename $otherargs $url; then + destarg = '' + if [ -n "$filename" ]; then + $destarg = " -O $outdir$filename" + + if output=$(wget --cut-dirs=100 -np -e robots=off -P $outdir$destarg $otherargs $url); then sed -i "/$filename/d" $list echo $filename logger -s -t $LOGTAG "downloaded $filename" else - logger -s -t $LOGTAG "downloading of $filename from $url failed." + logger -s -t $LOGTAG "downloading of $filename from $url failed: $output" fi done < $list diff --git a/postfix-delete.pl b/postfix-delete.pl new file mode 100755 index 0000000..ab75701 --- /dev/null +++ b/postfix-delete.pl @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +$REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!"; + +@data = qx; +for (@data) { + if (/^(\w+)(\*|\!)?\s/) { + $queue_id = $1; + } + if($queue_id) { + if (/$REGEXP/i) { + $Q{$queue_id} = 1; + $queue_id = ""; + } + } +} + +#open(POSTSUPER,"|cat") || die "couldn't open postsuper" ; +open(POSTSUPER,"|postsuper -d -") || die "couldn't open postsuper" ; + +foreach (keys %Q) { + print POSTSUPER "$_\n"; +}; +close(POSTSUPER); diff --git a/update-blocklist.sh b/update-blocklist.sh new file mode 100644 index 0000000..2c12070 --- /dev/null +++ b/update-blocklist.sh @@ -0,0 +1,10 @@ +# simple blacklist updater for OpenWRT + +#! /bin/sh +set -e + +blacklist=https://v.firebog.net/hosts/Easylist.txt +mkdir -p /tmp/dnsmasq-blocklist +wget --cut-dirs=100 -np -nH -O /tmp/dnsmasq-blocklist/ads $blacklist +sed -i -e 's/^/0.0.0.0 /' /tmp/dnsmasq-blocklist/ads +/etc/init.d/dnsmasq restart