Skip to content

Instantly share code, notes, and snippets.

@eqdw
Created April 7, 2010 02:57
Show Gist options
  • Save eqdw/358456 to your computer and use it in GitHub Desktop.
Save eqdw/358456 to your computer and use it in GitHub Desktop.
require 'securerandom'
require 'thread'
mutex = Mutex.new
pause = false
pauser = Thread.new do
while (true) do
s = gets
mutex.synchronize do
pause = s =~ /(PAUSE|pause)?/
end
end
end
opener = Thread.new do
while (true) do
mutex.synchronize do
unless pause
#this line thanks to burkelibbey
`open "http://grab.by/#{(rand 3)+2}#{SecureRandom.base64(2)[0..2]}"`
end
end
sleep 4
end
end
pauser.join
opener.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment