Created
March 28, 2021 11:08
-
-
Save ggdx/b237ffe6b21333f8e9363458ca7632b7 to your computer and use it in GitHub Desktop.
Adds a huge list of domains to block to /etc/hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
""" site_block.txt - https://gist.github.com/ggdx/e333c291312c90a6c5f35d5b06fd9632 | |
This script takes a while, could most likely be made more efficient but | |
does the job in prevent my kids from accessing things they shouldn't | |
as well as largely stops tracking scripts embedded in websites. | |
""" | |
path = './site_block.txt' | |
def read_large_file(file_handler): | |
for line in file_handler: | |
yield line | |
with open(path) as file_handler: | |
for url in read_large_file(file_handler): | |
os.system(f'echo "127.0.0.1 {url}" >> /etc/hosts') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment