-
-
Save wuputah/cd6a7f3781c288fbbc4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
scrot -s -e 'cloudapp $f; rm $f' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
['json', 'cloudapp_api'].each do |gem| | |
begin | |
require gem | |
rescue LoadError | |
puts "You need to install #{gem}: gem install #{gem}" | |
exit!(1) | |
end | |
end | |
config_file = "#{ENV['HOME']}/.cloudapp" | |
unless File.exist?(config_file) | |
puts "You need to type your email and password (one per line) into "+ | |
"`~/.cloudapp`" | |
exit!(1) | |
end | |
email,password = File.read(config_file).split("\n") | |
if ARGV[0].nil? | |
puts "You need to specify a file to upload." | |
exit!(1) | |
end | |
urls = [] | |
ARGV.each do |x| | |
CloudApp.authenticate(email,password) | |
puts "Attempting to upload #{x}" | |
url = CloudApp::Item.create(:upload, {:file => x}).url | |
# Say it for good measure. | |
puts "Uploaded #{x} to #{url}" | |
# Get the embed link. | |
url = "#{url}/#{ARGV[0].split('/').last}" | |
urls << url | |
end | |
# Copy it to your (linux) clipboard. | |
system %Q{echo '#{urls.join(',')}' | tr -d "\n" | xclip -i} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
noice 👍