Skip to content

Instantly share code, notes, and snippets.

@watson
Created February 9, 2010 15:22
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 watson/299306 to your computer and use it in GitHub Desktop.
Save watson/299306 to your computer and use it in GitHub Desktop.
This script polls the Apple Store every 4 seconds to see if it returns a good HTTP status code. When this happens, it uses your computer speakers to say "Hurray. The Apple Store is now open for business" (note: the sound only works on OS X). It works beca
require 'open-uri'
check_every = 4 # seconds
url = "http://store.apple.com/us"
check_again = true
print "Checking #{url}: "
while check_again
begin
sleep check_every
open url
check_again = false
puts "\nStore is back online!"
`say Hurray. The Apple Store is now open for business`
rescue
print "."
$stdout.flush
end
end
@oscahie
Copy link

oscahie commented Sep 25, 2014

Nice one, I wrote a similar script to monitor the iPhone 6 availability but didn't know about this 'say' command, so I printed BELL chars instead :) This is way more cool! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment