Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I switched from ABP to this hosts file a few months ago and I have zero regret. My browser's faster, lighter and ads are blocked just as well as with ABP.

I actually even started splitting my hosts file: the layout is

    /etc/hosts                ('compiled' version)
    /etc/hosts.d/
    /etc/hosts.d/aaa-warning  (warning reminding me to run `update-hosts` instead of modifying /etc/hosts. Appears atop the compiled file)
    /etc/hosts.d/adblock      (that website's hosts file)
    /etc/hosts.d/base         (original system hosts file)
    /etc/hosts.d/dolead       (work-related file for development)
And I have the following functions in my .bashrc file:

    function update-hosts() {
        cat /etc/hosts.d/* > /etc/hosts;
    }

    function update-adblock() {
        curl http://someonewhocares.org/hosts/zero/hosts -o /etc/hosts.d/adblock 2> /dev/null
        update-hosts
    }
So if I want to update "adblock" (it is obviously an improper name) I simply do `sudo update-adblock` and if I change another file (mostly `/etc/hosts.d/dolead`) I'll just run `sudo update-hosts`.

Works wonders.



I made a simple script that merges, and removes duplicates from different sources: https://gist.github.com/louima/878171fc67d797cfcef4


Interesting and thanks for sharing. I've been using https://gaenserich.github.io/hostsblock/


Most of my adblock stuff is CSS based. I use element hiding helper to figure out which bits to kill. I have hundreds of these custom rules.


To be pedantic: That's not blocking, it's just hiding. They have vastly different implications.


To be pedantic: It's blocking from displaying it but not from the downloading.


If you want to pull hosts files from multiple sources, you may want to consider sort'ing and uniq'ing to remove duplicates.


Have you been able to block stuff like Tynt, and other copy/paste triggered JS stuff?


I was not aware of Tynt, but I believe it's well blocked.

I just looked at the adblock-hosts file, and 'tynt' appears several times. One of those lines is commented with a link to an article about tynt[0]. I tried copy-pasting from The New Yorker and TechCrunch (who, as claimed by the author of the article, use tynt), and both times there was no crap appended.

0: http://daringfireball.net/2010/05/tynt_copy_paste_jerks


Thanks, I may try this out and see if I can move over my few custom blocked sites that implement this stuff.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: