Skip to content

Instantly share code, notes, and snippets.

@eladmeidar
Created October 15, 2009 02:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eladmeidar/210612 to your computer and use it in GitHub Desktop.
Save eladmeidar/210612 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
BLOCK_LIST = ["facebook.com", "twitter.com"]
ALLOWED_ACTIONS = ["start", "stop"]
begin
action = ARGV[0].to_s.downcase
if action.nil? || !(ALLOWED_ACTIONS.include?(action.downcase))
puts "USAGE: ruby b-productive.rb start|stop"
end
gem 'ghost'
require 'ghost'
case action
when "start"
BLOCK_LIST.each do |block_target|
Host.add(block_target, '127.0.0.1')
end
puts "Productivity enhanced +10!!!, (Blocked: #{BLOCK_LIST.join(', ')})"
when "stop"
BLOCK_LIST.each do |block_target|
Host.delete(block_target)
end
puts "Productivity degraded -10, (Now available for distraction: #{BLOCK_LIST.join(', ')})"
end
rescue Gem::LoadError
puts "you need to install the ghost gem from http://github.com/bjeanes/ghost"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment