hmmm....

Rotate Through Screen Windows

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

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

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):

1
2
3
4
5
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:

1
2
3
4
5
6
7
8
9
10
#!/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

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.

IPv6 rDNS Zones

Creating IPv6 rDNS zone files by hands sucks. I’ve seen one tool to do it (plus dhcp configs and forward zones) and references to another that seems to be gone from the net. The one I found is not well suited for my needs though. Is there something awesome I just haven’t found yet?

I guess I should stop being lazy and just write the tool. Maybe even serve it up via the web for others in my situation. Hmmm….

Most Awesome Command Ever - Timeout

I have a Debian Sid box that I’d been putting off updating for a while so finally got around to doing it tonight. I took the opportunity to do a bit of spring cleaning and purge old packages I installed to play with and forgot to purge or removed instead of purging. While doing this I discovered an interestingly named package, timeout.

timeout is a dead simple command, everything you need to know about it you can get from the usage information:

1
2
[michael@orion(~)] timeout
usage: timeout [-signal] time command...

And an example:

1
2
3
4
[michael@orion(~)] timeout 5 cat
Timeout: aborting command ``cat'' with signal 9
Killed
[michael@orion(~)] 

How did I not know about this before?!?

Overheard at Dinner…

Overheard at Dinner…

Yeah when I first moved here I was out near that <some plant> on route 9, that place looked weird so I asked, “What is that, a nuclear power plant?” joking, of course. But then they answered me, “No, the nuclear power plant is 2 miles further north”.

Dear Lazzy Web, Fingerprint Scanning?

Anybody know of some open source fingerprint scanning software for OS X? Bonus points if it has magic integration with stuffs like the keychain, auto log-in, screen saver disable, etc.

Failing available open source software, what about commercial software? I’m aware of software from upek that supports their Eikom as well as ancient software from Sony for their Puppy scanner. I’m looking for something that would support multiple scanners, ideally the U.are.U stuff. Though if anybody wanted to trade a pair of USB U.are.U scanners for an Eikom one, that would be great too ;)

Adding a Datastore to an RRD File

Mainly for personal future reference.

Adding a DS to a bunch of RRD files is a big pain, RRD doesn’t have any sort of native mechanism for doing this. The usual procedure is exporting the RRD data to XML, creating a new rrd file with the old datastores plus your new ones, then importing the data back in from the XML.

A while back I needed to do this for a load of RRDs so I wrote a quick and dirty bash script for it. Today I had reason to add a DS again but couldn’t find my script. A bit of googling was no help either, surely other people have this problem too? I discovered Nicola Worthington’s RRD::Simple contains an add_source method so a few moments in TextMate later we have:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl

use strict;
use warnings;

use RRD::Simple();

my $rrd_path = "/path/to/dir/of/rrds/";
my @rrd_files = <$rrd_path/*.rrd>;

my $rrd = RRD::Simple->new();

for my $file (@rrd_files) {
    print "Processing $file...";
    $rrd->add_source($file, 'DS_name' => 'DERIVE');
    print " ok.\n";
}