diff --git a/local/bin/push.sh b/local/bin/push.sh new file mode 100755 index 0000000..3ec02c2 --- /dev/null +++ b/local/bin/push.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Thanks to noctua for the base script +# Thanks to Iasoon for the advanced ssh config parsing +set -e + +sshhost="Flesje" +fles="http://flashyoshi.me" + +# Find ssh username +user=$( + # Join config entries + sed -n '$!{/host /I!{H;d}};x;s/\n/ /g;p' $HOME/.ssh/config | + # Extract user/host combinations + grep -i 'user' | + sed 's/^.*host \([^ \t]\+\).*user \([^ \t]\+\).*$/\1 \2/I' | + # Find user + (grep "^$sshhost" || echo $USER) | cut -d ' ' -f 2 ) + +file="$(mktemp XXXXXX.png)" +scrot $* "$file" +chmod 755 $file +scp -p $file $sshhost:~/images/ +rm "$file" +url="$fles:8080/~$user/images/$file" +notify-send "Screenshot uploaded to $url" +echo "$url" | xclip diff --git a/local/bin/shoot.sh b/local/bin/shoot.sh deleted file mode 100755 index 7f6304a..0000000 --- a/local/bin/shoot.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -file="$(mktemp XXXXXX.png)" -scrot $* "$file" -chmod 755 $file -scp -P 2222 "$file" ftper@178.116.153.116:'~/Pictures' -rm "$file" -url="http://178.116.153.116:8080/$file" -notify-send "Screenshot uploaded to $url" -echo "$url" | xclip -sel c -