Skip to content

Instantly share code, notes, and snippets.

@jakeoid
Last active December 5, 2016 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakeoid/442b93147b001fe92ef5afe374f423c4 to your computer and use it in GitHub Desktop.
Save jakeoid/442b93147b001fe92ef5afe374f423c4 to your computer and use it in GitHub Desktop.
Allows for you to upload files to catgirlsare.sexy from Terminal and using an Automater script, from anywhere.
# _ _
# ___ __ _ __ _ ___ _ _ _ __ | | ___ __ _ __| | ___ _ __
# / __/ _` |/ _` / __| | | | | '_ \| |/ _ \ / _` |/ _` |/ _ \ '__|
# | (_| (_| | (_| \__ \ | |_| | |_) | | (_) | (_| | (_| | __/ |
# \___\__, |\__,_|___/ \__,_| .__/|_|\___/ \__,_|\__,_|\___|_|
# |___/ |_|
#
#
# This script adds the ability to upload to the CatGirlsAre.Sexy server without
# having to open your webbrowser. Through the user of an automater script you can
# get it setup to automatically upload photos for you.
#
# Alert the user that the upload has begun.
osascript -e 'display notification "Please select an area." with title "catgirlsare.sexy" sound name "ok.wav"'
# Define where to store the images, folders name, files name (not necessary).
directoryname=Screenshots
filename="shot_`date '+%Y-%m-%d_%H-%M-%S'`.png"
path=~/Documents/$directoryname/
# Begin our screen capture.
screencapture -o -i $path$filename
# Open our new entry to use it!
entry=$path$filename
upload=$(curl -F key=<yourkeyhere> -F file=@"$entry" https://catgirlsare.sexy/api/upload)
# For debugging, I echo the file.
echo $upload
# Using Python we bodge together our responses URL tag from JSON!
item=$(echo $upload | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["url"];');
# Tell our user their new link is on the clipboard!
osascript -e 'display notification "Link has been copied to clipboard!" with title "Upload complete!" sound name "ok.wav"'
# Actually put the link on the clipboard.
echo "$item" | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment