Notices


Reply
Thread Tools
Posts: 527 | Thanked: 121 times | Joined on Feb 2010
#121
Hahahaha, indeed mate.
 
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#122
 
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#123
it's fascinating to see how such a project evolves

from:
Code:
#!/bin/bash

# determine number of files in /dconfs
cd /etc/hildon-welcome.d/dconfs/
nof=$(ls *.conf | wc -l)

# get random number
rn=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")

# in range of 1 - nof
let "rr = $rn % $nof + 1"

# choose random conf
rf="$rr.conf"
echo "$rr.conf"

# copy it over to default.conf
cp $rf ../default.conf

# exit
exit 0
to:
Code:
start on starting shutdown

script

  cd /etc/hildon-welcome.d/dconfs/

  if [ -f 1.conf ]; then

    # check which file is currently used
    if [ -f *.lock ]; then
      cuf=$(ls *.lock)
      ruf=$cuf
      rm *.lock
    else
      cuf="1.lock"
      ruf=$cuf
    fi

    # determine number of files in /dconfs
    nof=$(ls *.conf | wc -l)

    while [ "$ruf" = "$cuf" ]; do

      # get "random" number lol
      rn=$(date +%s)

      # in range of 1 - nof
      let "rr = $rn % $nof + 1"

      # choose random conf
      ruf="$rr.lock"
      rf="$rr.conf"
 
    done
 
    # set file for checking which file is in use
    rb="$rr.lock"

    # copy it over to default.conf
    cp $rf ../default.conf
    touch $rb

  fi

end script
btw:
this is why i love the n900. try to run such a script on any other phone. it won't be that easy (if it's possible at all... ^^)
 

The Following 2 Users Say Thank You to b666m For This Useful Post:
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#124
btw: i found something REALLY nerdy:

a hourglass random number generator ^^

take a look:
http://blog.makezine.com/archive/200...r_generat.html
 
Posts: 527 | Thanked: 121 times | Joined on Feb 2010
#125
Hahahaha, some guys have all the fun!
 
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#126
a summation in the end:

if you like having a single script and aren't afraid of using some xterm:
http://talk.maemo.org/showpost.php?p...5&postcount=35

if you want a gui and eyecandy:
http://talk.maemo.org/showpost.php?p...8&postcount=69

my work is done here.
 

The Following 2 Users Say Thank You to b666m For This Useful Post:
Posts: 527 | Thanked: 121 times | Joined on Feb 2010
#127
You did good!
 

The Following User Says Thank You to rolan900d For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 23:36.