tMerge branch 'master' of z3bra.org:scripts - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit b476cd935d451b5db8ff3356de4096fbe0e5aecd
(DIR) parent 6580eebca559bf8f24a110fc08ca62f7c1450b90
(HTM) Author: Willy Goiffon <willy@mailoo.org>
Date: Mon, 4 Nov 2013 01:12:28 +0100
Merge branch 'master' of z3bra.org:scripts
Diffstat:
M chat | 6 ++++++
M instagram | 19 ++++++++++++-------
M upload | 2 +-
3 files changed, 19 insertions(+), 8 deletions(-)
---
(DIR) diff --git a/chat b/chat
t@@ -9,6 +9,12 @@ SERV='irc.freenode.net'
PORT='6667'
CHAN='z3bra'
+usage() {
+ cat << EOF
+ usage: chat [-h] [-s server] [-c channel] [-n nickname]
+EOF
+}
+
[[ -n "$1" ]] && CHAN=$1
[[ -n "$2" ]] && NICK=$2
(DIR) diff --git a/instagram b/instagram
t@@ -17,10 +17,11 @@ source ~/.config/instagram 2>/dev/null
function usage() {
cat <<SHBLAH
-Usage : instagram [-tmuh] [-g number] [-s screen] [filename.png]
+Usage : instagram [-tmuwh] [-g number] [-s screen] [filename.png]
-t : create thumbnail
-m : create one shot per head
-u : upload the file using $UPLOAD_BIN <filename>
+ -w : take only a window for the shot (choose with pointer)
-h : display this help
-d path : save the shot in <path>
-g number : create a gif out of <number> shot (0.5 second between shots)
t@@ -44,7 +45,10 @@ function upload() {
[[ "$1" = "--help" ]] && usage && exit 0
-while getopts ":htmud:g:s:" opt; do
+# default window id
+WINDOW='root'
+
+while getopts ":htmuwd:g:s:" opt; do
case $opt in
t) THUMB=1 ;;
m) MULTI=1 ;;
t@@ -52,6 +56,7 @@ while getopts ":htmud:g:s:" opt; do
g) GIF=$OPTARG ;;
s) SCREEN=$OPTARG ;;
u) UPLOAD=1 ;;
+ w) WINDOW=$(xprop|grep 'window id'|cut -d\ -f7);;
h) usage; exit 0;;
?) echo "invalid option: -$OPTARG"; exit 1 ;;
esac
t@@ -70,21 +75,21 @@ if [[ "$MULTI" = "1" ]] || [[ -n $SCREEN ]]; then
xdpyinfo -ext XINERAMA | sed '/^ head #/!d;s///' |
while IFS=' :x@,' read i w h x y; do
if [[ $SCREEN = "$i" ]] || [[ -z $SCREEN ]]; then
- import -window root -crop ${w}x$h+$x+$y $SSHOT_DIR/head_$i-$OUTPUT
- [[ -n $THUMB ]] && import -window root -thumbnail 25% -crop ${w}x$h+$x+$y $SSHOT_DIR/thumb-head_$i-$OUTPUT
+ import -window ${WINDOW} -crop ${w}x$h+$x+$y $SSHOT_DIR/head_$i-$OUTPUT
+ [[ -n $THUMB ]] && import -window ${WINDOW} -thumbnail 25% -crop ${w}x$h+$x+$y $SSHOT_DIR/thumb-head_$i-$OUTPUT
fi
done
elif [ -n "$GIF" ]; then
mkdir $SSHOT_DIR/tmp
for i in $(seq 0 $GIF); do
- import -window root $SSHOT_DIR/tmp/gif${i}_${OUTPUT}
+ import -window ${WINDOW} $SSHOT_DIR/tmp/gif${i}_${OUTPUT}
sleep 0.5
done
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}
+ import -window ${WINDOW} $SSHOT_DIR/$OUTPUT
+ [[ -n $THUMB ]] && import -window ${WINDOW} -thumbnail 25% $SSHOT_DIR/thumb-${OUTPUT}
fi
if [[ "$UPLOAD" = "1" ]]; then
(DIR) diff --git a/upload b/upload
t@@ -3,7 +3,7 @@
host=gavroche
user=willy
port=22
-path=/srv/http/raw
+path=/srv/http/raw.z3bra.org
base=raw.z3bra.org
file=''