Skip to content

Instantly share code, notes, and snippets.

@abenson
Last active January 29, 2024 04:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • 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