Skip to content

Instantly share code, notes, and snippets.

@misuchiru03
Forked from abenson/etc.dnsmasq.conf
Last active June 22, 2018 02:31
Show Gist options
  • Save misuchiru03/7664dd3af62a2c633c47dc99f336fff2 to your computer and use it in GitHub Desktop.
Save misuchiru03/7664dd3af62a2c633c47dc99f336fff2 to your computer and use it in GitHub Desktop.
adblock setup
#!/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
https://adaway.org/hosts.txt
http://hosts-file.net/.%5Cad_servers.txt
http://www.malwaredomainlist.com/hostslist/hosts.txt
http://someonewhocares.org/hosts/hosts
http://pgl.yoyo.org/adservers/serverlist.php
http://winhelp2002.mvps.org/hosts.txt
https://gist.githubusercontent.com/misuchiru03/196223901118660b64720b630930fea3/raw/404259e65df80bd7a88484fc30d49c654c00dee9/youtube.adblock.hosts"
for url in $URLS; do
echo $url
curl -sL "$url" | grep -E "(^127|^0)" >> $FILE
done
sort -u $FILE | awk -F\ '/^(127|0)/ { print $0; print "::", $2;}' > /etc/hosts.adblock
chown root:root /etc/hosts.adblock
chmod 0644 /etc/hosts.adblock
rm $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment