Wmweather and Xsnow = perl fun :)

Wmweather and Xsnow = perl fun :)

Post by Sol ................................... » Sat, 27 Jan 2001 12:00:01



wind speed controls the snow speed and temp controls the snow colour :)

#!/usr/bin/perl
#
######################################################################

$basedir = "/home/httpd/www/cgibin/software";

&weather();

sub weather {

        open (FILE, "$basedir/kiad.txt");
        for ($i =0; $i < 5; $i++) {
        $temper = <FILE>;
        }
        close (FILE);

        open (FILE, "$basedir/kiad.txt");
        for ($i =0; $i < 11; $i++) {
        $windspeed = <FILE>;
        }
        close (FILE);

# Round off speed
 $wind = sprintf("%.0f",$windspeed);

# round off temp
 $temp = sprintf("%.0f",$temper);

# multiply for effect ;P
 $wind2 = "$wind" * 10;

print "Windspeed is '$wind2' and Temp is '$temp'\n\r";

$colour = "white";

if ($temp > 30) {$colour = "blue";}
if ($temp > 45) {$colour = "yellow";}
if ($temp > 60) {$colour = "orange";}
if ($temp > 80) {$colour = "red";}

# Kill old process
$xsnowkill = qx(kill -9 `ps ax | grep xsnow | grep -v grep | awk '{
print $1; }'`);
# print "$xsnowkill\n\n";

$xsnower = qx(xsnow -nosanta -notrees -norudolf -nokeepsnowonwindows
-nokeepsnowonscreen -sc $colour -yspeed $wind2 -xspeed $wind2);
# print "$xsnower\n";

Quote:}

--
_______________________________________

     o
    /  --|

Quote:>:)---8

    \  --|
     o

_______________________________________

Sent via Deja.com
http://www.deja.com/

 
 
 

Wmweather and Xsnow = perl fun :)

Post by Jan Schauman » Sat, 27 Jan 2001 12:20:59



Quote:> wind speed controls the snow speed and temp controls the snow colour :)

Neat. :)

-Jan

--
Jan Schaumann <http://www.netmeister.org>

% man: why did you get a divorce?
man:: Too many arguments.

 
 
 

1. Fun fun fun! :)

I upgraded xf 4.0 to xf 4.0.1 on my PPC running YDL 1.2 (redhat).  I
wanted the latest and greatest video driver... which seems to be very
nice, so far!!

Well, for anyone about to do this, be warned that the XF86Config file
has incorrect keyboard mappings for G4s, anyway.  You can copy the old
settings from the old config file, and you have to do some tweaking
since the config file format has changed, but I think it will be obvious
to you when you compare the two.

Good luck to anyone else out there who is getting ready to upgrade.  I
also upgraded gnome to helix-gnome last night...  that too was an
adventure.  But thanks to the many helpful people who read this
newsgroup, I was able to get through it!   :)

Thanks!

Mike J.

2. Software available? Where to find it?

3. fun, fun fun

4. back up hardware

5. KIllustrator: fun, fun, fun.

6. hercules dynamite power and 65k colors???

7. IPFW and Dummynet fun :)

8. question about crontab

9. Hot, Fun S.F. Startup Seeks Gaggle of Perl Programmers

10. Matrox Mystique ands X.

11. Problems with browser redirection (Apache ErrorDocument and Perl Location:)

12. Perl script "ftpput" question (yes it's ME again) :)

13. Ethernet card fun/APM fun