tnew scripts - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 2434d446b4622c0efd9da1d450dc71f6d6b8ed6a
(DIR) parent 7456e9b03b0b3646004497eae3b07907945d1277
(HTM) Author: Willy Goiffon <w.goiffon@gmail.com>
Date: Tue, 11 Jun 2013 17:30:17 +0200
new scripts
Diffstat:
A instagram | 14 ++++++++++++++
A square | 6 ++++++
A tubes | 51 +++++++++++++++++++++++++++++++
3 files changed, 71 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/instagram b/instagram
t@@ -0,0 +1,14 @@
+#!/bin/sh
+
+SSHOT_DIR=~/usr/pics/scrnsht/
+
+import -window root $SSHOT_DIR/$1
+import -window root -thumbnail 25% $SSHOT_DIR/thumb-$1
+
+
+# Use for multi-head
+#
+# xdpyinfo -ext XINERAMA | sed '/^ head #/!d;s///' |
+# while IFS=' :x@,' read i w h x y; do
+# import -window root -crop ${w}x$h+$x+$y $SSHOT_DIR/head_$i-$1
+# done
(DIR) diff --git a/square b/square
t@@ -0,0 +1,6 @@
+#!/bin/bash
+
+echo
+for i in {0..7}; do echo -en " \e[0;3${i}m▉▉▉▉\e[0m"; done; echo
+for i in {0..7}; do echo -en " \e[1;3${i}m▉▉▉▉\e[0m"; done; echo
+echo
(DIR) diff --git a/tubes b/tubes
t@@ -0,0 +1,51 @@
+#!/bin/sh
+
+declare -i f=75 s=13 r=2000 t=0 c=1 n=0 l=0
+declare -ir w=$(tput cols) h=$(tput lines)
+declare -i x=$((w/2)) y=$((h/2))
+declare -ar v=( [00]="\x83" [01]="\x8f" [03]="\x93"
+ [10]="\x9b" [11]="\x81" [12]="\x93"
+ [21]="\x97" [22]="\x83" [23]="\x9b"
+ [30]="\x97" [32]="\x8f" [33]="\x81" )
+
+OPTIND=1
+while getopts "f:s:r:h" arg; do
+case $arg in
+ f) ((f=($OPTARG>19 && $OPTARG<101)?$OPTARG:$f));;
+ s) ((s=($OPTARG>4 && $OPTARG<16 )?$OPTARG:$s));;
+ r) ((r=($OPTARG>0)?$OPTARG:$r));;
+ h) echo -e "Usage: pipes [OPTION]..."
+ echo -e "Animated pipes terminal screensaver.\n"
+ echo -e " -f [20-100]\tframerate (D=75)."
+ echo -e " -s [5-15]\tprobability of a straight fitting (D=13)."
+ echo -e " -r LIMIT\treset after x characters (D=2000)."
+ echo -e " -h\t\thelp (this screen).\n"
+ exit 0;;
+ esac
+done
+
+tput smcup
+tput reset
+tput civis
+while ! read -t0.0$((1000/$f)) -n1; do
+ # New position:
+ (($l%2)) && ((x+=($l==1)?1:-1))
+ ((!($l%2))) && ((y+=($l==2)?1:-1))
+
+ # Loop on edges (change color on loop):
+ ((c=($x>$w || $x<0 || $y>$h || $y<0)?($RANDOM%7-1):$c))
+ ((x=($x>$w)?0:(($x<0)?$w:$x)))
+ ((y=($y>$h)?0:(($y<0)?$h:$y)))
+
+ # New random direction:
+ ((n=$RANDOM%$s-1))
+ ((n=($n>1||$n==0)?$l:$l+$n))
+ ((n=($n<0)?3:$n%4))
+
+ # Print:
+ tput cup $y $x
+ echo -ne "\033[1;3${c}m\xe2\x94${v[$l$n]}"
+ (($t>$r)) && tput reset && tput civis && t=0 || ((t++))
+ l=$n
+done
+tput rmcup