scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit 905b528b6dc7a586978776b5bb76f56c5d14e6d3
parent 1121c6b8f1793b4d91236cfd926edb9dbedeecd7
Author: Willy Goiffon <w.goiffon@gmail.com>
Date:   Thu Sep  5 15:14:25 +0200

Merge branch 'master' of gitorious.org:z3bra/scripts

Conflicts:
	instagram

Diffstat:
instagram | 17++++++++++++++---
upload | 18+++++++++---------
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/instagram b/instagram @@ -1,6 +1,7 @@ #!/bin/bash -SSHOT_DIR=~/usr/img/scrn +IMAGE_DIR=~/usr/img +SSHOT_DIR=$(IMAGE_DIR)/wm function usage() { cat <<SHBLAH @@ -16,13 +17,18 @@ Also, do not give path to shot. They're saved to $SSHOT_DIR by default. SHBLAH } -while getopts ":htmdg:s:" opt; do +function upload() { + ~/bin/upload $1 +} + +while getopts ":htmud:g:s:" opt; do case $opt in t) THUMB=1 ;; m) MULTI=1 ;; d) SSHOT_DIR=$OPTARG ;; g) GIF=$OPTARG ;; s) SCREEN=$OPTARG ;; + u) UPLOAD=1 ;; h) usage; exit ;; ?) echo "invalid option: -$OPTARG"; exit 1 ;; esac @@ -55,7 +61,12 @@ elif [ -n "$GIF" ]; then convert -delay 100 -loop 0 $SSHOT_DIR/tmp/gif*$OUTPUT $SSHOT_DIR/${1/jpg/gif} else import -window root $SSHOT_DIR/$OUTPUT - [[ -n $THUMB ]] && import -window root -thumbnail 25% $SSHOT_DIR/thumb-$OUTPUT + [[ -n $THUMB ]] && import -window root -thumbnail 25% $SSHOT_DIR/thumb-${OUTPUT} +fi + +if [[ "$UPLOAD" = "1" ]]; then + cd ${IMAGE_DIR)r} + upload wm/${OUTPUT} fi meh $SSHOT_DIR/$OUTPUT diff --git a/upload b/upload @@ -1,15 +1,15 @@ #!/usr/bin/bash -host=ssh.blinkenshell.org -user=z3bra -port=443 -path=public_html -base=z3bra.blinkenshell.org +host=gavroche +user=willy +port=22 +path=/srv/http/raw +base=raw.z3bra.org file='' tmpfile=/tmp/paste -clear > $tmpfile +echo '' > $tmpfile if [[ $# -eq 0 ]]; then while read line; do @@ -24,20 +24,20 @@ fi for f in $file; do case $(file $f| grep -o -E 'text|image') in text) - ext=txt + ext=plain ;; image) ext=img ;; *) - ext=rand + ext=null ;; esac name=$(echo $f| sed 's@^.*/\([a-zA-Z0-9.]*\)$@\1@') url="http://${base}/${ext}/${name}" - scp -P ${port} $f ${user}@${host}:${path}/$ext/$name && echo $url + scp ${host}:${path}/$ext/$name && echo $url done [[ -f $tmpfile ]] && rm $tmpfile