Skip to content

Instantly share code, notes, and snippets.

@mellowagain
Created April 28, 2018 22:17
Show Gist options
  • Save mellowagain/017bf7468aec9df99889abf8565f9c4a to your computer and use it in GitHub Desktop.
Save mellowagain/017bf7468aec9df99889abf8565f9c4a to your computer and use it in GitHub Desktop.
Automatic uploading of screenshots to your SFTP server. Requires maim and a server that serves the uploaded file like nginx.
#!/bin/sh
filename=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)
maim -s /tmp/$filename.png
sftp -v -oIdentityFile=path marc@wontfix.club << EOF
put /tmp/$filename.png /var/www/wontfix.club/html/i/
EOF
echo -n "https://wontfix.club/i/$filename.png" | xclip -sel clip
rm -rf /tmp/$filename.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment