3 ms·
Sorry to be the guy decrying PHP, but the only arguments I've found in it's favor are it's ubiquity and being sometimes "the right tool for the job" if you're q
by rbxbx 15y ago
Sorry to be the guy decrying PHP, but the only arguments I've found in it's favor are it's ubiquity and being sometimes "the right tool for the job" if you're quickly hacking together a dynamic webpage.
Surely a simple cli app isn't the right job for this tool.
Now, all that said, it _does_ work, and blahblahblah.
- yogsototh 15y agoYep, beware I didn't even tested it: #!/usr/bin/env zsh (($#<1)) && { print -- "usage: $0:t (play|work)" exit 1 }>&2 blacklist=( reddit.com ycombinator.com slashdot.com ) hostfile=/etc/host if [[ $1 = "play" ]]; then if [[ ! -e $hostfile.orig ]]; then cp $hostfile{,.orig} else print -- "You're already playin" >&2 exit 1 fi cp $hostfile{.orig,} for elem in $blacklist; do print -- "127.0.0.1\t$elem" >> /etc/host print -- "127.0.0.1\twww.$elem" >> /etc/host done fi if [[ $1 = "work" ]]; then cp $hostfile{.orig,} \rm $hostfile.orig fi /etc/init.d/networking restart