-
-
Save javierarce/4038854 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
# Download file from URL + Upload to your server + Copy short URL to your clipboard | |
# Use it like this: | |
# gi http://25.media.tumblr.com/tumblr_md2j4a4Eot1rddgbmo1_1280.png | |
# And get something like this: | |
# tumblr_md2j4a4Eot1rddgbmo1_1280.png 100% 41KB 41.4KB/s 00:00 | |
# Copied to the clipboard: http://goo.gl/ITEIG | |
function gi() { | |
url=$1 | |
filename=$(basename "$url") | |
wget --no-verbose "$url" | |
scp "$filename" YOUR_SERVER_USERNAME@DOMAIN_URL.com:~/img; | |
curl \ | |
-s https://www.googleapis.com/urlshortener/v1/url \ | |
-H 'Content-Type: application/json' \ | |
-d '{"longUrl": "'"http://DOMAIN_URL.com/DIRECTORY/$filename"'"}' | egrep -o 'http://goo.gl/[^"]*' | pbcopy | |
rm $filename | |
echo "Copied to the clipboard:" "\033[1;32m$(pbpaste)\033[m" | |
} |
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
function scpp() { | |
scp "$1" YOUR_SERVER_USERNAME@DOMAIN_URL.com:~/img; | |
curl \ | |
-s https://www.googleapis.com/urlshortener/v1/url\?key\=API_KEY \ | |
-H 'Content-Type: application/json' \ | |
-d '{"longUrl": "'"http://DOMAIN_URL.com/DIRECTORY/$1"'"}' | egrep -o 'http://goo.gl/[^"]*' | pbcopy | |
echo "Copied to the clipboard:" "\033[1;32m$(pbpaste)\033[m" | |
} |
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
function scpp() { | |
scp "$1" YOUR_SERVER_USERNAME@DOMAIN_URL.com:~/img; | |
curl \ | |
-s https://www.googleapis.com/urlshortener/v1/url \ | |
-H 'Content-Type: application/json' \ | |
-d '{"longUrl": "'"http://DOMAIN_URL.com/DIRECTORY/$1"'"}' | egrep -o 'http://goo.gl/[^"]*' | pbcopy | |
echo "Copied to the clipboard:" "\033[1;32m$(pbpaste)\033[m" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on: https://dl.dropbox.com/u/39519/talks/html5dc-workflow/index.html#17