A Silver Lining?

A recurring theme of late has been that our hopes for institutions that many of us thought where "too big" to dismantle, may have been misplaced.

  • The Department of Education
  • The Environmental Protection Agency
  • The Federal Communications Commission
  • The Justice Department

I fear that we will soon find out just how vulnerable many of us are as these institutions are gutted, or even, possibly, abolished.

The idealist in me wishes for a world were libertarian ideas and practices result in better products and services, without sacrificing our health, environment or future generations.

But time and time again we have seen what happens when those in a position of power or authority do what is in their best interests, and it is seldom good.

Which brings me to a possible silver lining.

Maybe if people see the destruction and chaos that some of these decisions will bring, they will look back and realize that they can't blame the Other for the trials and tribulations, they will have to recognize that they brought this upon not just themselves, but all of us.

Maybe we will see those that are not governed only by their own self interest or greed step up and do The Right Thing for others.

Maybe we will see local and state officials do more to protect the people they serve than our federal government is doing.

Maybe we will see a massive amount of financial support from individuals to make up for the federal funding that is no longer going to be enough.

Maybe we will see people give money to teachers so that the children in our schools have enough supplies without forcing the teacher to spend their own money.

Maybe we will see police officers welcome review of policies and wistleblowers exposing unethical or corrupt behavior.

Maybe we will come out of this better off.

I hope so, but I fear that it may take so long that I will never live to see it. I hope that my nieces and nephews can see it. I hope that we turn this around before they are required to be the solution.

I hope that they live to see us being kinder to one another.

I hope that the sky is still blue, that the trees still grow, that the water is clean.

I hope that I never lose hope.

Dust off and nuke it from orbit...

I'm in the process, hopefully ongoing, of tossing out stuff that I don't need/want anymore. IF I can make it through my office, I then have to do the same thing in the garage. Too many "Maybe one day..." projects have stacked up.

Projects that I will never get to if I don't get things cleaned up.

Projects that I don't know that I even want to continue with.

I need a place to put my lab rack for learning Cisco gear/software. I've used their products for years, but I have never done anything to formally learn about how it works. It's all just been picked up as I worked on solutions to problems.

I need to cut down on the number of computers I am trying to maintain at home. Too many old laptops that aren't really worth maintaining. I think I should bite the bullet and get just the hardware that I actually need to get things done. Get rid of the rest.

I need to be able to get on the amateur radio bands without it being a major production ( to get the desk that I use for that ).

I need to be able to work on some programming projects. Projects that will help me learn python better, which is a current goal. Projects that will automate and streamline things that are done manually now.

So many of the things I want to do have been stopped or stalled by not wanting to deal with the hassle of actually getting to them.

Jekyll to Nikola, not so hard afterall

After I made my last post I was looking through the plugins available for Nikola and found one called 'import_jekyll'. A quick

nikola -i plugin import_jekyll
nikola import_jekyll ~/technomage.net

And I was done!

Wait, nope, that didn't work. After doing some poking around, I had to edit the plugin to fix a path definition. There is a bug report that had the needed information.

Ok, now let's run nikola import_jekyll ~/technomage.net

Yay! Files moved. Then I had to enable markdown... and then I had to go through and fix a bunch of import errors. '.code:: LANG' added before code blocks, which doesn't mean anything to markdown, but I guess means something to rst.

Several of the tags had each word split out with commas between each letter, which made the tag cloud look a little strange.

I will need to update this post with specific links to what I needed to do, and I still need to import the ham radio site. Since that one has lots of pictures, I think it will take more work, we'll see.

UPDATE: added the link for fixing the path issue.

Starting over

As I recently changed employers, I thought it might be a good idea to start blogging again.

And I also thought it would be a good idea to try something new, so I am giving Nikola a spin. Previously I have used wordpress, serendipity, octopress, jekyll and even webmake.

I've made a few changes in regards to the tools that I use lately, and this felt like another good change to make. I am using emacs and Org-Mode for notes and project planning. I thought about using some of the converters to use emacs to create my blog, but I decided to use something that was a little more editor agnostic.

I'm also using ruby and starting to look at using python for dev work instead of my goto of perl, not because perl can't do what I want, but because I want to try something different. Also, python is already being used for some projects at work, so it's something I should spend some time on anyway :)

I will most likely be merging my ham radio site into this one, because I want to simplify things a little bit. Not that getting all the content moved over will be simple, but in the long term I think it will be worth the effort. Many of the things that I am interested in cross over between ham radio, games, life, and general geekery.

Courage, Bravery and Heroism

I see people trying to compare one act of courage, bravery or heroism to another. These are all ways to describe someone acting despite their fear, uncertainty and doubt.

While there are many actions that will automatically be described in that way, they are not the only ones. Running into a burning building to save someone else or standing in harms way to protect others are two examples that are easily identified. But for some people just leaving their home is overcoming fear. Speaking in front of an assembled group of ones peers. Standing up to a bully. Taking a stand for something you believe in, whether that be a religious, moral or ethical issue. Depending on the time and place, these could all be very brave and courageous acts.

Just because something is not a challenge for you, or you do not agree with what someone else is doing does not mean that for them it is not an act of courage, bravery or heroism. Don't dismiss or judge harshly someone else just because you don't think what they are doing is brave or you don't agree with them.

One day it will be you that is overcoming fear, uncertainty and doubt in a way that others do not understand or approve of.

Watching long processes through CGI

After slamming my head against a wall for a few hours Friday trying to implement: Watching long processes through CGI

I gave up and left the office. The thing that was really frustrating was that it appeared to be working, and then suddenly, it didn't. And when I even went back and ran Randall's code without any modification, it still didn't work. I was stumped.

Fast forward 12 hours, after some food, some sleep and more searching on google. Here's a clue: It is possible that the original article was written for apache 1.x, not apache 2.x. Anyway, I found a post on perlmonks.org where someone was having a similar problem, and they indicated that explicitly closing STDERR and STDIN, as well as STDOUT let the script work as intended.

So here is my diff against the listing in Randall's original article from 2002.

--- col39.listing.txt   2015-03-21 02:01:08.260866239 -0500
+++ /usr/lib/cgi-bin/session_test.cgi  2015-03-21 03:03:34.656454963 -0500
@@ -34,6 +34,8 @@
    print redirect(self_url());
    } elsif (defined $pid) {    # child does
    close STDOUT;             # so parent can go on
+      close STDERR;
+      close STDIN;
    unless (open F, "-|") {
        open STDERR, ">&=1";
        exec "/usr/sbin/traceroute", $host;

Hopefully this saves some other poor schmuck from leaving a bloody dent in their desktop.

fixing the raid

I noticed a couple weeks ago that I kept getting errors in the logs for one of the disks in the multimedia array. This was upsetting, but since I had paid a little more for these disks to get the 5 year warranty, I wasn't too concerned. Then I did a warranty check on the disk. It was the disk that WD sent me to replace the last disk that failed.

Oh goody.

After futzing with the WD support website, they had changed it since the last time I had to RMA a disk, I finally got an advance RMA setup. The disk arrived last week, but I was unable, until today, to get around to replacing it.

So I powered down the server, pulled the bad disk ( installed 2011-04-20 according to the label I put on it ) and put the new one in it's place. Then I rebooted. The system complained about a degraded array, was I sure I wanted to continue, even though I hit 'y', it dropped to a minimal recovery shell. sigh

Reboot, let's try this again. Same thing.

dirty words

Reboot again, hit 'e' to edit the boot paramemeters in GRUB, add 'bootdegraded=true' and voila, it boots.

Now to it was as simple as:
Copy the partition map from the existing drive...

# sfdisk -d /dev/sde | sfdisk/dev/sda

Add the new disk into the array:

# mdadm --manage /dev/md127 --add /dev/sda1

And check on the progress:

 # cat /proc/mdstat 
 Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5]
 [raid4] [raid10] 
 md127 : active raid1 sda1[2] sde1[0]
       1953511936 blocks [2/1] [U_]
       [>....................]  recovery =  3.8% (75987264/1953511936) finish=218.8min speed=142988K/sec

unused devices: <none>

Not too shabby!

# df -kh /multimedia/
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/raid--lvm-movies  1.8T  841G  882G  49% /multimedia

Now I just need to get the old drive back into the shipping box and get it back to WD so they don't charge me $220 for the replacement disk.

PECL::Perl and Net::Telnet

Well, I wasn't going to, but I decided to install the PECL::Perl extension for PHP afterall. So far it seems to work with the two modules that were proving to be difficult to find native PHP replacements for, Text::Diff and Net::Telnet.

Here is an example of using it with Net::Telnet:


$perl = new Perl();
$perl->eval('use Net::Telnet');

$t = $perl->eval(<<<'PERL_END'
new Net::Telnet(
   Prompt => '/\S+[#>][ ]?$/'

$t->open( '' );
$t->login( $username, $password );

$lines = $t->array->cmd( 'show ver' );

print_r( $lines );

I am sure that there are people that are going to hate this solution :)

PHP and networks

Well, I did not install the perl PHP extension. I think my friend Benjamin summed it up the best when he responded to my post about it on facebook:

{% pullquote %} Dmitry Stogov claims to be the lead developer, but I'm pretty sure that it was the devil.

So now I am back to looking for a good way to do diffs in PHP of files that are sometimes 75,000+ lines. Either my google-fu has improved and I have not seen some of these solutions before, or it has not and I blocked out the memory of having tested some of these solutions. We'll see which it is when I get into the office tomorrow.

Also, the other special kind of fun that I was trying to find a solution for was a replacement for the perl module Net::Netmask. Thanfully I found a github gist that had just what I was looking for!

Reproduced here are the ones that I adapted for what I needed, mainly so I can find them again later.


# REFERENCE - http://stackoverflow.com/questions/2942299/converting-cidr-address-to-subnet-mask-and-network-address

$ipNetmask = "";
list($ip, $netmask) = split( "/", $ipNetmask );
$ip_elements_decimal = split( "[.]", $ip );
for($i=1; $i <= $netmask; $i++) {
$netmask_result .= "1";
for($i=$netmask+1; $i <= 32; $i++) {
   $netmask_result .= "0";
echo $netmask_result;
$netmask_ip_binary_array = str_split( $netmask_result, 8 );
$netmask_ip_decimal_array = array();
foreach( $netmask_ip_binary_array as $k => $v ){
   $netmask_ip_decimal_array[$k] = bindec( $v ); // "100" => 4
   $network_address_array[$k] = ( $netmask_ip_decimal_array[$k] & $ip_elements_decimal[$k] );
$network_address = join( ".", $network_address_array );



# REFERENCE http://stackoverflow.com/questions/594112/matching-an-ip-to-a-cidr-mask-in-php5

function cidr_match($ip, $range)
   list ($subnet, $bits) = split('/', $range);
   $ip = ip2long($ip);
   $subnet = ip2long($subnet);
   $mask = -1 << (32 - $bits);
   $subnet &= $mask; # nb: in case the supplied subnet wasn't correctly aligned
   return ($ip & $mask) == $subnet;

if (cidr_match("", "")) {
   echo 'match';
} else {
   echo 'no match';

echo cidr_match("", "");


function mask2cidr($mask) {

$mask = split( "[.]", $mask );

$bits = 0;

foreach ($mask as $octect) {
   $bin = decbin($octect);
   $bin = str_replace ( "0" , "" , $bin);
   $bits = $bits + strlen($bin);
   return $bits;

echo mask2cidr("");


Here we go again

I just can't seem to leave well enough alone.

Well, really, I kind of blame the current projects that I am working on for my employer. It's drawing me back into the world of webdesign. And while I wasn't unhappy with the octopress site that I was using, it felt a little too restrictive. Yeah, the guy that just wanted to be about to write on his blog decided to retool it. Again.

This time I am using vanilla jekyll but with bootstrap and jquery and fontawesome.

I'm not sure if my coworker is going to be happy that I found this stuff, and of course, now want to use them in the tools we are building...

Man, if only these tools would have been available ~16 years ago...