Skip to content

Instantly share code, notes, and snippets.

@paulsmith
Created May 31, 2012 20:13
Show Gist options
  • Save paulsmith/2845915 to your computer and use it in GitHub Desktop.
Save paulsmith/2845915 to your computer and use it in GitHub Desktop.
The least user-friendly version of `Freedom' I could come up with
# ~/.bashrc
# Freedom!
freedom () {
sed '/# FREEDOM/{n;s/^#//;}' < /etc/hosts > /tmp/hosts.$$ &&
sudo mv /tmp/hosts.$$ /etc/hosts
}
disable-freedom () {
sed '/# FREEDOM/{n;s/^[^#]/#&/;}' < /etc/hosts > /tmp/hosts.$$ &&
sudo mv /tmp/hosts.$$ /etc/hosts
}
You should not do this. You should use http://macfreedom.com/ or friends.
$ freedom
later …
$ disable-freedom
It’s not quite Freedom in that you can disable it at will. It should really use `at(1)' or some sort of boot-time process for that.
# /etc/hosts
127.0.0.1 localhost
# ...
# FREEDOM
127.0.0.1 twitter.com facebook.com news.ycombinator.com getprismatic.com buzzfeed.com # ... many, many more ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment