Skip to content

Instantly share code, notes, and snippets.

@noook
Last active November 7, 2018 18:14
Show Gist options
  • Select an option

  • Save noook/a3c96e3e8fd2d968f2b712cff86fd0f9 to your computer and use it in GitHub Desktop.

Select an option

Save noook/a3c96e3e8fd2d968f2b712cff86fd0f9 to your computer and use it in GitHub Desktop.
Uploads a screenshot to the server and copies the link in the clipboard
generate_uid() {
NEWUID=$(openssl rand -base64 15 | sed -E 's/[\/\+=]//' | head -c 6);
CODE=$(curl -sI https://domain.tld/$NEWUID.png | head -n 1|cut -d$' ' -f2);
if [ $CODE == 200 ];then
echo $(generate_uid);
else
echo $NEWUID;
fi
}
ID=$(generate_uid);
echo "https://domain.tld/$ID.png" | pbcopy &
screencapture -o -i /tmp/$ID.png;
scp -q /tmp/$ID.png [email protected]:/path/to/folder;
rm /tmp/$ID.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment