aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2014-04-25 23:55:14 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2014-04-25 23:55:14 +0200
commit25401108bc8811a93e537b0b99e3dbfa07917b5a (patch)
tree0ac242baadab4679f56ec2877b61c0613f3a504a
parenta85422ff63e037483ad9351cd8135d8a7bf52e08 (diff)
downloadbin-25401108bc8811a93e537b0b99e3dbfa07917b5a.tar.xz
scrotpomf.bash: Init import
-rwxr-xr-xscrotpomf.bash27
1 files changed, 27 insertions, 0 deletions
diff --git a/scrotpomf.bash b/scrotpomf.bash
new file mode 100755
index 0000000..bb679fc
--- /dev/null
+++ b/scrotpomf.bash
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+SCROTARGS=()
+while (( "$#" )); do
+ SCROTARGS+=($1)
+ shift
+done
+
+# take the shot
+FILE="$(scrot ${SCROTARGS[@]} -e 'echo -n $f')"
+
+# upload it and grab the URL
+printf "Uploading scrot\n"
+JSON="$(curl -sf -F "files[]=@$FILE" http://pomf.se/upload.php)"
+BASE="$(jshon -e files -e 0 -e url -u <<< $JSON)"
+
+URL="http://a.pomf.se/$BASE"
+
+# copy the URL to the clipboard
+if [[ "$(type -p xclip)" ]]; then
+ echo -n "$URL" | xclip -selection clipboard
+ echo "$URL (has been copied to clipboard)"
+else
+ echo "$URL"
+fi
+
+rm -f "$FILE"