Live data from Hacker News

BeGoneAds – A Python script that blocks ads by installing common hosts files

github.com

21–30 of 97 posts

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#22
post #9
post #6

Earlier quoted context omitted.

I also don't understand systemd integration in the todo.

The goal here is to make it automatically update the hosts file once in a while

Isn’t that what cron is for?

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#23

How is this different or better than Steven Black's project? Repo: https://github.com/StevenBlack/hosts

my first question too. Steve Black's updateHostesFile.py is extensible and can be automated and is well trusted and gets tested by a large community. I don't want to sound critical but would like to understand the value add in comparison. Both are in python as well so I don't get it

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#24

Python scripts to modify system files make me a little skittish, even with source code available. I think I would just as soon grab the hosts file from https://www.someonewhocares.org/ and drop it in myself.

Why?

Why not?

Modifying system hosts configuration requires privileged file system access.

The mindset here should be default deny.

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#25

Anybody have a sense of the performance overhead of using hosts files versus a detached hardware solution like a pihole?

Not much.

62,448 line (63,370 actual '0.0.0.0' entries) /etc/hosts file, 100x resolving 'www.google.com', Debian GNU/Linux, Thinkpad with spinning rust.

The short version has 32 lines, with 14 active entries, mostly defaults and local systems.

Short hosts:

    $ for i in {1..100}; do time host www.google.com; done 2>&1| grep real |  sed 's/^real[       ]*//; s/0m//; s/s$//' | mean
    n: 100, sum: 2.209, min: 0.015, max: 0.052, mean: 0.022090, median: 0.02, sd: 0.007450
    %-ile:  5: 0.016, 10: 0.016, 15: 0.016, 20: 0.016, 
    25: 0.0165, 30: 0.02, 35: 0.02, 40: 0.02, 45: 0.02, 
    55: 0.02, 60: 0.02, 65: 0.02, 70: 0.021, 75: 0.022, 
    80: 0.0245, 85: 0.029, 90: 0.033, 95: 0.0385
Big hosts:

    $ for i in {1..100}; do time host www.google.com; done 2>&1| grep real |  sed 's/^real[       ]*//; s/0m//; s/s$//' | mean
    n: 100, sum: 2.517, min: 0.016, max: 0.063, mean: 0.025170, median: 0.023, sd: 0.009818
    %-ile:  5: 0.016, 10: 0.016, 15: 0.016, 20: 0.016, 
    25: 0.017, 30: 0.0185, 35: 0.02, 40: 0.021, 45: 0.022, 
    55: 0.024, 60: 0.0255, 65: 0.0265, 70: 0.028, 75: 0.029, 
    80: 0.03, 85: 0.0325, 90: 0.0395, 95: 0.042
The delta of means is .003080s -- call it 3ms slower for the large hosts file.

("mean" is an awk script for computing univariate moments.)

As others have mentioned, the main benefit of a centralised LAN service is that all devices on the LAN are protected. The hosts file on this system (a laptop) is effective regardless of where I am. It also pre-dates my configuring OpenWRT's adblock package about a month ago, though I'd had a hand-rolled DNSMasq configuration earlier. The laptop hosts file is almost certainly a few years out of date -- another occupational hazard of such things.

The OpenWRT solution runs on the Knot Resolver (kresd) caching nameserver. I've not noted any lag for it. The blocklist there is currently 231,627 hosts/domains (roughly doubled: specific + wildcard matches), from 0-29.com to zzzpooeaz-france.com.

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#26

Earlier quoted context omitted.

My understanding is that difference is in scope, not performance. Hosts files will only affect the host (workstation/desktop/laptop etc) they're installed on. Things like piHole try to make it easy to apply the solution to all members of your network - which even in household cases these days can number in dozens, making it impractical to manage hosts files for all of them (This includes items like phones which are t…

It would be nice to see a performance hit based on the number of hosts entries.

About 3ms for 68k entries: https://news.ycombinator.com/item?id=20148457

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#27

I use host flash: http://host-flash.com/ Does anyone know an up-to date list for blocking social networks?

Steve Black's hosts file ... just specify "-e social" or "--extension social" option, or use a "myhosts" file to name your own domains for a subset (e.g. all of facebook or whatever)

https://github.com/StevenBlack/hosts

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#28

How is this different or better than Steven Black's project? Repo: https://github.com/StevenBlack/hosts

my first question too. Steve Black's updateHostesFile.py is extensible and can be automated and is well trusted and gets tested by a large community. I don't want to sound critical but would like to understand the value add in comparison. Both are in python as well so I don't get it

I assume you wrote a hello world once or twice, what was the point of that?

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#29

Earlier quoted context omitted.

my first question too. Steve Black's updateHostesFile.py is extensible and can be automated and is well trusted and gets tested by a large community. I don't want to sound critical but would like to understand the value add in comparison. Both are in python as well so I don't get it

I assume you wrote a hello world once or twice, what was the point of that?

sure I did but I didn't bother with a "Show HN", also this is well beyond the scope of a Hello World. It just made me wonder if OP hasn't studied what was already out there and if he did why no explanation or credit or mention of Steven's work ...

even if he disagreed with Steven solution and chose to reimplement, it would have been interesting to understand what the motivation was. I'm not saying he shouldn't, but just that it would be nice to know what motivated his design and why he thinks it's better to redo ...

Re: BeGoneAds – A Python script that blocks ads by installing common hosts files

#30

Earlier quoted context omitted.

my first question too. Steve Black's updateHostesFile.py is extensible and can be automated and is well trusted and gets tested by a large community. I don't want to sound critical but would like to understand the value add in comparison. Both are in python as well so I don't get it

I assume you wrote a hello world once or twice, what was the point of that?

Who posts their hello world on HN? My question was a valid one given the circumstances.
Post reply on HN