Skip to content

Instantly share code, notes, and snippets.

@ushis ushis/put.zsh
Last active Mar 31, 2017

What would you like to do?
# Uploads files to honkgong.
# Specify some files like so:
# put <file> [<file> ...]
# Or pipe some data into it:
# cat file1 file2 | put
# Have a nice day!
put() {
local f url=''
# Read from stdin, if there are no arguments.
if [ $# -eq 0 ]; then
curl --data-binary @- "${url}"
return $?
# Try to send every provided file.
for f in $*; do
if [ ! -r "${f}" ]; then
print "Can't read:" "${f}" 1>&2
curl -T "${f}" -H "Content-Type: $(file -b --mime-type ${f})" "${url}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.