Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

replacement script for gyazo to save files to your dropbox public folder

View gyazo_dropbox.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/env ruby
 
dropbox_user_id = 'YOUR_DROPBOX_USER_ID'
nyazo_folder_name = 'nyazo' # or your folder name of choice
 
system_user = IO.popen("whoami", "r+").gets.chomp
nyazo_folder_path = "/Users/#{system_user}/Dropbox/Public/#{nyazo_folder_name}"
system "mkdir -p #{nyazo_folder_path}"
filename = "#{(0...8).map{65.+(rand(25)).chr}.join.downcase}.png"
image_path = "#{nyazo_folder_path}/#{filename}"
system "screencapture -i \"#{image_path}\""
if File.exist?(image_path)
system "sips -d profile --deleteColorManagementProperties \"#{image_path}\""
end
 
url = "https://dl.dropbox.com/u/#{dropbox_user_id}/#{nyazo_folder_name}/#{filename}"
system "echo #{url} | pbcopy"
# sleep 3 # major hack
system "open #{url}"
 
if !File.exist?(image_path) then
exit
end
Owner

This has two issues:

  • I don't know how to make the browser open once the upload is complete so it just waits a couple seconds
  • If you cancel the screenshot, the browser still opens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.