Skip to content

Instantly share code, notes, and snippets.

@oquno
Created June 10, 2009 15:01
Show Gist options
  • Save oquno/127267 to your computer and use it in GitHub Desktop.
Save oquno/127267 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# -*- ruby -*-
#
# $Date$
# $Rev$
#
require 'cgi'
require 'digest/md5'
cgi = CGI.new("html3")
imagedata = cgi.params['imagedata'][0].read
hash = Digest::MD5.new(imagedata).to_s[0,4]
File.open("/var/www/gyazo/#{hash}.png","w").print(imagedata)
cgi.out { "http://gyaz.oq.la/#{hash}" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment