Initial zsh version of get-shit-done
This commit is contained in:
commit
e4bf0c5896
1 changed files with 61 additions and 0 deletions
61
get-shit-done
Normal file
61
get-shit-done
Normal file
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
(($#<1)) && {
|
||||
print -- "usage: ${0:t} (work|play)" >&2
|
||||
exit 1;
|
||||
}
|
||||
|
||||
hostfile=/etc/hosts
|
||||
backupfile=$hostfile.orig
|
||||
|
||||
blacklist=( 'reddit.com'
|
||||
'forums.somethingawful.com'
|
||||
'somethingawful.com'
|
||||
'digg.com'
|
||||
'break.com'
|
||||
'news.ycombinator.com'
|
||||
'infoq.com'
|
||||
'bebo.com'
|
||||
'twitter.com'
|
||||
'facebook.com'
|
||||
'blip.com'
|
||||
'youtube.com'
|
||||
'vimeo.com'
|
||||
'delicious.com'
|
||||
'flickr.com'
|
||||
'friendster.com'
|
||||
'hi5.com'
|
||||
'linkedin.com'
|
||||
'livejournal.com'
|
||||
'meetup.com'
|
||||
'myspace.com'
|
||||
'plurk.com'
|
||||
'stickam.com'
|
||||
'stumbleupon.com'
|
||||
'yelp.com'
|
||||
'slashdot.org' )
|
||||
|
||||
case $1 in
|
||||
work)
|
||||
[[ -e $backupfile ]] && {
|
||||
print -- "$backupfile already exists, wou are in working mode" >&2
|
||||
exit 1
|
||||
}
|
||||
\cp $hostfile $backupfile
|
||||
for site in $blacklist; do
|
||||
print -- "127.0.0.1\t$site"
|
||||
print -- "127.0.0.1\twww.$site"
|
||||
done >> $hostfile
|
||||
;;
|
||||
play)
|
||||
\cp $backupfile $hostfile && \rm $backupfile
|
||||
;;
|
||||
*)
|
||||
{
|
||||
print -- "I don't know this option: '$*'"
|
||||
print -- "use ${0:t} work or ${0:t} play"
|
||||
exit 1
|
||||
} >&2
|
||||
esac
|
||||
|
||||
[[ -e /etc/init.d/networking ]] && /etc/init.d/networking restart
|
Loading…
Reference in a new issue