diff options
Diffstat (limited to 'scripts/scripts/up')
-rwxr-xr-x | scripts/scripts/up | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/scripts/up b/scripts/scripts/up new file mode 100755 index 0000000..6b9ece4 --- /dev/null +++ b/scripts/scripts/up | |||
@@ -0,0 +1,20 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | id=$( cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 2 | head -n 1 ) | ||
4 | |||
5 | if [ $# != 1 ]; then | ||
6 | echo "needs an arg" | ||
7 | else | ||
8 | if [ -f "$1" ]; then | ||
9 | ext="${1##*.}" | ||
10 | id="$id.$ext" | ||
11 | scp -P 22222 "$1" ferrn:~/www/nerd/uploads/"$id" | ||
12 | echo "https://u.peppe.rs/$id" | ||
13 | if hash xclip 2> /dev/null; then | ||
14 | echo "https://u.peppe.rs/$id" | xclip -selection clipboard | ||
15 | echo "https://u.peppe.rs/$id" | xclip -i | ||
16 | fi | ||
17 | else | ||
18 | echo "file does not exist" | ||
19 | fi | ||
20 | fi | ||