Skip to content

Instantly share code, notes, and snippets.

@svandragt svandragt/iup.sh
Last active May 6, 2019

Embed
What would you like to do?
Upload latest screenshot in ~/Pictures and notify URL and send to clipboard
#!/bin/bash
# v1 - 2019-05-06
# Upload latest screenshot in ~/Pictures and notify URL and send to clipboard
# requires a domain to upload; xclip to send to clipboard; and gnome to notify.
SITE='https://my.domain'
FILE=$(ls -t ~/Pictures/Screenshot*.png | head -1)
if [ ! -z "$FILE" ]; then
HASH=$(md5sum "$FILE"| head -n1 | awk '{print $1;}')
mv "$FILE" "/tmp/${HASH}.png"
scp -q "/tmp/${HASH}.png" user@my.domain:/path/to/webroot/
URL="${SITE}/${HASH}.png"
echo $URL
echo $URL | xclip -selection clipboard
notify-send 'Image uploaded' "$URL"
fi
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.