Skip to content

Instantly share code, notes, and snippets.

@gwillem
Created March 13, 2018 12:41
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 gwillem/4f089caf42873e741ea744bab932355a to your computer and use it in GitHub Desktop.
Save gwillem/4f089caf42873e741ea744bab932355a to your computer and use it in GitHub Desktop.
One button screenshot uploader for Ubuntu
#!/bin/bash
# Requires xclip.
# Will create screenshot, upload to your server over SSH and copies the URL to the clipboard for your pleasure.
SRC_PATH=$1
SRC_FILE=$(/usr/bin/basename $SRC_PATH)
PREFIX=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
DST_FILE="${PREFIX}.png"
DST_URL="https://<YOURHOST>/screenshots/$DST_FILE"
echo now uploading $FILE to $DST_URL
/usr/bin/scp $SRC_PATH <YOURHOST>:/data/www/screenshots/$DST_FILE
echo $DST_URL | /usr/bin/xclip -selection clipboard
/usr/bin/notify-send -i face-laugh 'Success!' "Saved at $DST_URL (URL on clipboard)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment