Skip to content

Instantly share code, notes, and snippets.

@quirkey
Created September 3, 2010 01:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save quirkey/563236 to your computer and use it in GitHub Desktop.
Save quirkey/563236 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'open-uri'
category = ARGV[0] || 'fail'
url = "http://api.cheezburger.com/xml/category/#{category}/lol/random"
open(url) do |f|
xml = f.read
if xml =~ /LolImageUrl\>([^\<]*)/m
puts $1
else
puts "could not find lol"
end
end
@quirkey
Copy link
Author

quirkey commented Sep 3, 2010

Ideal usage:

  open `lol`

@quirkey
Copy link
Author

quirkey commented Sep 3, 2010

If you're daring
curl http://gist.github.com/raw/563236/d2b6f73ea2bd1ed82b4bbbea883d00dbd22ecb06/lol > /usr/local/bin/lol

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