Skip to content

Instantly share code, notes, and snippets.

@abenson
Last active January 29, 2024 04:12
Show Gist options
  • Save abenson/68e24b62d1e6e9cb303676aee95e7f50 to your computer and use it in GitHub Desktop.
Save abenson/68e24b62d1e6e9cb303676aee95e7f50 to your computer and use it in GitHub Desktop.
adblock setup
...
# adblock
addn-hosts=/etc/hosts.adblock
...
#!/bin/sh
exec snooze -d 2/5 /usr/local/bin/update-adblock
#!/bin/sh
FILE=$(mktemp)
touch $FILE
URLS="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://raw.githubusercontent.com/notracking/hosts-blocklists/master/hostnames.txt"
for url in $URLS; do
echo $url
curl -sL "$url" | grep '^0' >> $FILE
done
sort -u $FILE > /etc/hosts.adblock
chown root:root /etc/hosts.adblock
chmod 0644 /etc/hosts.adblock
rm $FILE
sv reload dnsmasq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment