putting things from a to b, and so
This commit is contained in:
parent
325af279d4
commit
a4cb8e85c7
1 changed files with 39 additions and 23 deletions
|
@ -12,6 +12,8 @@ HEXPPM="images/$FNAME.hexppm"
|
||||||
PIXLIST="/tmp/$FNAME.pixlist"
|
PIXLIST="/tmp/$FNAME.pixlist"
|
||||||
SHUFMODE="$3"
|
SHUFMODE="$3"
|
||||||
|
|
||||||
|
FLOOTSRUNNING=0
|
||||||
|
|
||||||
test -z "$FLOOTFORKS" && FLOOTFORKS="2"
|
test -z "$FLOOTFORKS" && FLOOTFORKS="2"
|
||||||
|
|
||||||
declare -a PIXMAP
|
declare -a PIXMAP
|
||||||
|
@ -23,7 +25,7 @@ function hex() {
|
||||||
printf "%02X%02X%02X" ${*//','/' '}
|
printf "%02X%02X%02X" ${*//','/' '}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###### OLDFOOO ######
|
||||||
|
|
||||||
gen_pixmap() {
|
gen_pixmap() {
|
||||||
y=0
|
y=0
|
||||||
|
@ -69,22 +71,6 @@ gen_pixmap() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gen_field() {
|
|
||||||
|
|
||||||
test -z $W && W=640
|
|
||||||
test -z $H && H=480
|
|
||||||
test -z $COLOR && COLOR="666999"
|
|
||||||
echo "drawing $W x $H - $COLOR" >&2
|
|
||||||
for x in $(seq 1 $W)
|
|
||||||
do
|
|
||||||
for y in $(seq 1 $H)
|
|
||||||
do
|
|
||||||
echo "PX $x $y $COLOR"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
draw_pixmap() {
|
draw_pixmap() {
|
||||||
y=1
|
y=1
|
||||||
test -z $x_ppm && echo "x_ppm missing" && exit 1
|
test -z $x_ppm && echo "x_ppm missing" && exit 1
|
||||||
|
@ -155,6 +141,27 @@ draw_pixmap() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
###### END OLDFOOO ######
|
||||||
|
|
||||||
|
|
||||||
|
gen_field() {
|
||||||
|
|
||||||
|
test -z $W && W=640
|
||||||
|
test -z $H && H=480
|
||||||
|
test -z $COLOR && COLOR="666999"
|
||||||
|
echo "drawing $W x $H - $COLOR" >&2
|
||||||
|
for x in $(seq 1 $W)
|
||||||
|
do
|
||||||
|
for y in $(seq 1 $H)
|
||||||
|
do
|
||||||
|
echo "PX $x $y $COLOR"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
convertimg() {
|
convertimg() {
|
||||||
|
|
||||||
if [ -n "$RESIZE" ]
|
if [ -n "$RESIZE" ]
|
||||||
|
@ -211,9 +218,11 @@ flootworker()
|
||||||
{
|
{
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
#FLOOTSRUNNING=$((FLOOTSRUNNING+1))
|
||||||
echo "$(shuf_xy)
|
#test $FLOOTSRUNNING -le $FLOOTFORKS &&
|
||||||
|
echo "$(shuf_xy)
|
||||||
${LOL[$i]}" > /dev/tcp/$IPFLOOT/1337
|
${LOL[$i]}" > /dev/tcp/$IPFLOOT/1337
|
||||||
|
#FLOOTSRUNNING=$((FLOOTSRUNNING-1))
|
||||||
#echo "${LOL[$i]}" > /dev/tcp/127.0.0.1/1337 &
|
#echo "${LOL[$i]}" > /dev/tcp/127.0.0.1/1337 &
|
||||||
|
|
||||||
#echo "worker $i PID ${LOLPID[$i]}"
|
#echo "worker $i PID ${LOLPID[$i]}"
|
||||||
|
@ -242,8 +251,9 @@ floot() {
|
||||||
# generate a tmp file, as i have trouble atm to figure out
|
# generate a tmp file, as i have trouble atm to figure out
|
||||||
# why free space get lost when i generate the pixlist directly
|
# why free space get lost when i generate the pixlist directly
|
||||||
# in ram
|
# in ram
|
||||||
|
echo "generating tmp file $PIXLIST"
|
||||||
convertimg > $PIXLIST
|
convertimg > $PIXLIST
|
||||||
echo "convert and shuffle pixels for $FLOOTFORKS workers"
|
echo "shuffle pixels in $PIXLIST for $FLOOTFORKS workers"
|
||||||
for i in $(seq 1 $FLOOTFORKS)
|
for i in $(seq 1 $FLOOTFORKS)
|
||||||
do
|
do
|
||||||
#LOL[$i]="OFFSET 1 200"
|
#LOL[$i]="OFFSET 1 200"
|
||||||
|
@ -251,7 +261,7 @@ floot() {
|
||||||
# LOL[$i]="$(shuf_xy)"
|
# LOL[$i]="$(shuf_xy)"
|
||||||
#LOL[$i]="$(cat $PIXLIST | shuf)"
|
#LOL[$i]="$(cat $PIXLIST | shuf)"
|
||||||
|
|
||||||
echo -n "worker $i .."
|
echo -n "prepare worker $i .."
|
||||||
|
|
||||||
if [ -z "$ALPHACOLOR" ]
|
if [ -z "$ALPHACOLOR" ]
|
||||||
then
|
then
|
||||||
|
@ -265,6 +275,7 @@ floot() {
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "starting $FLOOTFORKS workers"
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
for i in $(seq $FLOOTFORKS)
|
for i in $(seq $FLOOTFORKS)
|
||||||
|
@ -272,8 +283,13 @@ floot() {
|
||||||
#echo "check worker $i PID ${LOLPID[$i]} if running "
|
#echo "check worker $i PID ${LOLPID[$i]} if running "
|
||||||
if [ -z ${LOLPID[$i]} ] || ! ps -p ${LOLPID[$i]} > /dev/null
|
if [ -z ${LOLPID[$i]} ] || ! ps -p ${LOLPID[$i]} > /dev/null
|
||||||
then
|
then
|
||||||
flootworker &
|
echo "worker $i is not running, starting it"
|
||||||
LOLPID[$i]=$!
|
#if [ "$FLOOTSRUNNING" -le "$FLOOTFORKS" ]
|
||||||
|
#then
|
||||||
|
flootworker &
|
||||||
|
LOLPID[$i]=$!
|
||||||
|
#fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue