Good Friday, March 29

Remember that pop-science noise a while back about married people living longer?

Let's posit that's actually the case. I could buy it, because I think what happens is that, single past a certain age, you just lay awake staring at the ceiling every single night until the insomnia stress and all of the terribly honest thoughts give you cancer or a heart attack or the kind of drug habit that your acquaintances eventually stop describing as "functional".

Saturday, March 23

In honor of today’s weather, some Perl:

#!/usr/bin/env perl

use strict;
use warnings;
use 5.10.0;

use Time::HiRes qw(sleep);
use Term::ReadKey qw(GetTerminalSize);
use File::Slurp;

my @snowflakes = qw(❄ ❅ ❆);
my ($width, $height) = GetTerminalSize();

my $cpu_count = grep { /^processor\s+: [0-9]/ } read_file('/proc/cpuinfo');

while (1) {
   my ($load) = (read_file('/proc/loadavg') =~ m/^([\d.]+)/);
   my $heaviness = int($load / $cpu_count);
   for (0 .. $heaviness) {
       my $flake = $snowflakes[ rand @snowflakes ];
       say ' ' x int(rand($width)) . $flake;
   }

   if ($heaviness > 0) {
       sleep (1 / $heaviness)
   } else {
       sleep .75;
   }
}