Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'rubygems'
- require 'mechanize'
- browser = ENV['BROWSER'] ? ENV['BROWSER'] : 'xdg-open'
- clipcmd = "echo -n %s | xclip -selection clipboard"
- scheme = '%Y-%m-%d-%s.png'
- location = '~/images/'
- path = `scrot -s '#{scheme}' -e 'mv $f #{location}$f; echo -n #{location}$f'`
- if path == "" then exit end
- agent = Mechanize.new
- resp = agent.post("http://gyazo.com/upload.cgi", :imagedata => File.new(path, 'rb'))
- system "xdg-open '#{resp.body}' >/dev/null"
- system "#{clipcmd % [resp.body]}"
Advertisement
Add Comment
Please, Sign In to add comment