Skip to content

Instantly share code, notes, and snippets.

@stefanpenner
Forked from eladmeidar/b-productive.rb
Created October 15, 2009 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanpenner/210690 to your computer and use it in GitHub Desktop.
Save stefanpenner/210690 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'ghost'
module Productivity
BLOCK_LIST = %W{ facebook.com twitter.com }
def start
puts "Blocked:"
BLOCK_LIST.each do |host|
Host.add(host,'127.0.0.1')
puts ' - ' + host
end
end
def stop
puts "un-blocked:"
BLOCK_LIST.each do |host|
Host.delete(host)
puts ' - ' + host
end
end
end
if __FILE__ == $0
include Productivity
case ARGV[0]
when /^start$/i then start
when /^stop$/i then stop
else
puts "USAGE: ruby b-productive.rb start|stop"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment