Archive for June, 2008

Rotate through Screen Windows

Thursday, June 26th, 2008

A new command in screen version 4.00 is the idle command.

idle time command

Executes screen command, command when idle for time seconds. E.g. to rotate through screen windows with a 3 second interval:

idle 3 next

To cancel, idle 0

Superman vs. Spiderman

Saturday, June 7th, 2008

I promise I’m not a comic book/super hero[tm] nerd, not that it’s a bad thing. I’ve never owned comic books but last night I was thinking about Superman vs. Spider-Man for some reason.

I think that Superman is the clear winner, he was super duper from the start. Spider-Man on the other hand, he just happened to get bit by a messed up spider. I didn’t consider this a highly weighted factor though. Superman is impervious to all but kryptonite, Spider-Man is way vulnerable.

Batman, though crazy cool with all the gadgets, isn’t even in the running what with no super powers and all.

Weather in Screen Statusbar

Thursday, June 5th, 2008


Caspar Clemens Mierau recently wrote about a nifty Debian package named weather-util and his method for embedding the current temperature into the screen status bar. Quite nifty. I did the same with one small exception, including the predicted probability of precipitation if it exists.

My one liner that runs from cron (split to multiple lines for readability):

 weather -iKACY -f | head -n 9  | \
     awk '/Temperature/ { print $2 "F" }
          /Relative/ { print $3 }
          /precipitation/ { sub (/ chance of.+$/, ""); print "POP " $NF }' | \
     xargs echo > /home/michael/.weather

More details on the full implementation in the original post over at Caspar Clemens Mierau’s blog. And yes, I stole his loadavg stuff too ;)

UPDATE:

Silly me, upon further investigation, two things to note. First, the -i option applies only to current conditions and not to the forecast. In my case I actually want weather -f ACY and /etc/weatherrc takes care of the rest. Secondly, the field number for the precipitation percentage changes, oops. I’ve correctly accounted for this in the updated awk script above.

After making these changes I decided the awk script was getting a bit long for a single line so I went all out creating ~/bin/weather.awk:

#!/usr/bin/awk -f

/Temperature/       { temp = $2 }
/Relative Humidity/ { rh = $3   }
/precipitation/     { sub (/ chance of.+$/, "");
                      precip = $NF;
                      exit
                   }

END{ print temp "F " rh " POP " precip }

My crontab entry now looks like:

*/5 * * * *     weather -f ACY | /home/michael/bin/weather.awk > /home/michael/.weather

Much simpler.

Module::Signature Rocks My Socks

Sunday, June 1st, 2008

Just discovered the perl module Module::Signature by 唐鳳 (Audrey Tang) the other day. It’s pretty spiffy.

Implementing is easy (stolen from the docs):

MakeMaker:

    WriteMakefile(
        (MM->can('signature_target') ? (SIGN => 1) : ()),
        # ... original arguments ...
    );

Module::Build:

   Module::Build->new(
        (sign => 1),
        # ... original arguments ...
    )->create_build_script;

Don’t forget to add SIGNATURE to your MANIFEST if needed.

Then when running make dist you will be prompted for the pass phrase for your gpg key. For extra goodness, add 0-signature.t to your tests. It includes a single test that verifies the package cryptographically during make test if the TEST_SIGNATURE environment variable is set.

If you know waltman and haven’t heard of this module, yell at him for not telling you about it, he’s mentioned in the AUTHORS file for his stellar documentation patches.