Created
January 30, 2014 22:30
-
-
Save kyrias/8721436 to your computer and use it in GitHub Desktop.
Take a scrot and upload it to pomf.se
This file contains hidden or 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 bash | |
SCROTARGS=() | |
while (( "$#" )); do | |
SCROTARGS+=($1) | |
shift | |
done | |
# take the shot | |
FILE="$(scrot ${SCROTARGS[@]} -e 'echo -n $f')" | |
# upload it and grab the URL | |
printf "Uploading scrot\n" | |
JSON="$(curl -sf -F "files[]=@$FILE" http://pomf.se/upload.php)" | |
BASE="$(jshon -e files -e 0 -e url -u <<< $JSON)" | |
URL="http://a.pomf.se/$BASE" | |
# copy the URL to the clipboard | |
if [[ "$(type -p xclip)" ]]; then | |
echo -n "$URL" | xclip -selection clipboard | |
echo "$URL (has been copied to clipboard)" | |
else | |
echo "$URL" | |
fi | |
rm -f "$FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment