Skip to content

Instantly share code, notes, and snippets.

/g.sh

Created January 15, 2012 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save anonymous/1616651 to your computer and use it in GitHub Desktop.
Save anonymous/1616651 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
cmd = %Q{curl https://gist.github.com/gists -s -L -o /dev/null -w "%{url_effective} " }
files = ARGV.empty? ? Dir["**/*"] : Dir[*ARGV].uniq
files.select { |f| File.file?(f) }.each_with_index do |path, i|
cmd << %Q{-F "file_ext[gistfile#{i}]=#{File.extname(path)[1..-1]}" }
cmd << %Q{-F "file_name[gistfile#{i}]=#{File.basename(path)}" }
cmd << %Q{-F "file_contents[gistfile#{i}]=<#{path}" }
end
exec cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment