aboutsummaryrefslogtreecommitdiff
path: root/scripts/scripts/up
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/scripts/up')
-rwxr-xr-xscripts/scripts/up20
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
3id=$( cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 2 | head -n 1 )
4
5if [ $# != 1 ]; then
6 echo "needs an arg"
7else
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
20fi