tMerge branch 'master' of gitorious.org:z3bra/scripts - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 905b528b6dc7a586978776b5bb76f56c5d14e6d3
(DIR) parent 1121c6b8f1793b4d91236cfd926edb9dbedeecd7
(HTM) Author: Willy Goiffon <w.goiffon@gmail.com>
Date: Thu, 5 Sep 2013 15:14:25 +0200
Merge branch 'master' of gitorious.org:z3bra/scripts
Conflicts:
instagram
Diffstat:
M instagram | 17 ++++++++++++++---
M upload | 18 +++++++++---------
2 files changed, 23 insertions(+), 12 deletions(-)
---
(DIR) diff --git a/instagram b/instagram
t@@ -1,6 +1,7 @@
#!/bin/bash
-SSHOT_DIR=~/usr/img/scrn
+IMAGE_DIR=~/usr/img
+SSHOT_DIR=$(IMAGE_DIR)/wm
function usage() {
cat <<SHBLAH
t@@ -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
t@@ -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
(DIR) diff --git a/upload b/upload
t@@ -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
t@@ -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