Skip to content

Instantly share code, notes, and snippets.

@zyuiop
Created October 16, 2015 23:19
Show Gist options
  • Save zyuiop/a2fdf058bdb7b27e37de to your computer and use it in GitHub Desktop.
Save zyuiop/a2fdf058bdb7b27e37de to your computer and use it in GitHub Desktop.
Upload a file to a VPS with a random name
#!/bin/bash
fileName=$1
targetName=$(date +%s | sha256sum | base64 | head -c 8)
file=$(basename "$fileName")
extension="${file##*.}"
scp $fileName vps:~/screenshots/$targetName"."$extension
echo "http://i.zyuiop.net/"$targetName"."$extension | xclip -selection c
echo "Uploaded "$targetName"."$extension" ! URL copied to clipboard."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment