Skip to content

Instantly share code, notes, and snippets.

@llybin
Last active February 15, 2024 14:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save llybin/73502a930808e368c6de27c7f1fdce1d to your computer and use it in GitHub Desktop.
Save llybin/73502a930808e368c6de27c7f1fdce1d to your computer and use it in GitHub Desktop.
screencloud script upload by ssh
#!/bin/bash
SERVER="user@myserver.com"
SERVER_PATH="/srv/i.myserver.com/"
SERVER_URL="https://i.myserver.com/"
TMP_LOCAL_DIR="/tmp"
IMG_EXT=".png"
UPLOAD_METHOD="upload_image_scp"
IMG_NAME_METHOD="img_name_random"
function upload_image_scp {
scp $tmp_fullname "$SERVER:$SERVER_PATH$tmp_filename"
}
function img_name_random {
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12 ; echo
}
tmp_filename=`$IMG_NAME_METHOD`$IMG_EXT
tmp_fullname=$1
$UPLOAD_METHOD $tmp_fullname
echo "$SERVER_URL$tmp_filename" | xsel -i --clipboard
@hex0gen
Copy link

hex0gen commented Apr 23, 2019

TY it's working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment