Skip to content

Instantly share code, notes, and snippets.

@dehidehidehi
Created December 28, 2021 23:20
Show Gist options
  • Select an option

  • Save dehidehidehi/580554cf855665dcadc8c1a478054825 to your computer and use it in GitHub Desktop.

Select an option

Save dehidehidehi/580554cf855665dcadc8c1a478054825 to your computer and use it in GitHub Desktop.
/etc/hosts : Block adservers, facebook products, and cryptominers urls
# Block advertisers, facebook products, and cryptominer scripts
# into a new file which can replace /etc/hosts.
# Make a dir to store the to-be downloaded files.
mkdir /etc/hosts.d/blocked
cp /etc/hosts /etc/hosts.d/blocked/previous-hosts-contents.txt
cd /etc/hosts.d/blocked
# Download block lists directly from officially maintained repositories.
curl -o adservers.txt https://raw.githubusercontent.com/anudeepND/blacklist/master/adservers.txt
curl -o facebook-extended.txt https://www.github.developerdan.com/hosts/lists/facebook-extended.txt
curl -o coinminers-all.txt https://gitlab.com/ZeroDot1/CoinBlockerLists/-/raw/master/list.txt?inline=false
# Merge all .txt files into one file.
# as the hosts file.
cat /etc/hosts.d/blocked/*.txt > /etc/hosts.d/blocked/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment