Mar 282011

This past weekend I finally completed the LED modification I began on my guitar.  It’s something I started in (I think) November of last year.  It really didn’t take that long, but I was just too lazy to put the finishing touches on it.  A couple hours of work late last year got me some LED’s installed under the pickups of my Ibanez RG 220 and a 9 volt battery adapter hanging out the back.  It worked and looked pretty sweet, but I had to leave the back cover off the guitar so I could get at the adapter.  Furthermore, in order to turn the lights off and on I had to disconnect or connect the battery altogether.  As of this past weekend, I am able to satisfactorily call the project complete.

I’ll describe what I did in a little more detail.  I removed the strings on the guitar (it was time to change them anyways) and then unmounted the pickup brackets from the top of the guitar.  I bought eight red LED’s at Radio Shack and made two vaguely rectangular circuits of LED’s and then tied them to some lead wire.  I fed the wire through the same holes the pickup leads came through, then tied them together, put a resistor in place to cut back the current from the battery, attached a 9-volt battery terminal to those and that was that.  It didn’t look quite right when I tested it.  The light was too direct and obscured.  I searched around the Internet a little bit and found a nice article someone else did with this same project and his solution was to cut out two pieces of plastic and layer them with some translucent Scotch tape to diffuse the light.  So in the pickup cavities on my guitar, there is a nice layered deal of LED’s, plastic, and pickup on top of that.

That’s the way it’s sat for the past 3 or 4 months.  I finally got tired of having the back cover off and having a 9 volt battery hanging out the back, AND having to disconnect the battery if I wanted to use the lights at all.  So I got off my butt and stopped at Radio Shack again and bought a sub-mini toggle switch.  I got out my drill and made a nice 1/4″ hole in the guitar right between the volume and tone knob, cut one of the leads from the 9 volt terminal and tied the resulting wire into the switch.  I then fed the front of the switch through the guitar and bolted it on, voila!  Glowing red pickups that I figure increase my shredability by at least 37.9%.


Mar 242011

Being able to communicate over the network directly with bash is nothing new, but it’s not something that is used very often, nor is it something that most bash tutorials teach you about.  Most of the time, it is probably easier and faster to call other commands like netcat, mutt, or wget (just a few off the top of my head that I use quite often) rather than using built-ins, but I’ve run into a few cases in the past where one or more of these tools was not available on a production machine and installing them would have taken too long by the time I went through the red tape of getting approval through standard change control procedures.

One of the fringe benefits of this write-up is that we also get to review a highly overlooked and underused aspect of bash programming – file descriptors!

First thing we need to do is open a connection to a remote host.  In bash, this is accomplished by redirecting input and/or output to a special file in /dev.  The file path will vary depending on the remote host and port to which you want to connect, but for our purposes, let’s use our good friend Google to demonstrate how to do a pseudo wget or curl.  The first thing we’ll do is

The exec 5<> portion tells bash to open a file descriptor numbered 5 (an arbitrary number I picked) and use it to read data from and write data to the pseudo-device located at /dev/tcp/ (which, if you run ls in /dev, you’ll find does not really exist).  All this says is to connect to on TCP port 80 – the standard HTTP port.

Despite the fact that /dev/tcp/ does not exist, you’ll find that there is a new file created located at /dev/fd/5 that is a symbolic link to something along the lines of “socket:[<some number>].”  So far, so good.

So now we’ve got a file descriptor communicating over the network.  Let’s send an HTTP request:

You can verify the request went through okay by verifying that the return code was 0:

We can get the response that Google’s web server sent us with the following:

You should see a bunch of HTML and javascript get blasted to your terminal, so maybe you’d want to write it to a file instead (note that running the initial cat <&5 flushes the data buffer and you’d have to do another GET request before running the following):

Using this method you could use a shell script to check simple web pages or script a mail session by connecting directly to your mail relay, or do any number of network testing.  It’s no replacement for the binary tools that are created to do the job, but in a pinch, these tips could really come in handy.

Mar 092011

I got my first opportunity to point spar the other night.  What that means is free sparring and each hit is worth a point (kicks to the head are worth 2 points).  My opponent: a recommended black belt.  I’d like to think I made a decent showing given my experience handicap, but the truth of the matter is that I was so soundly beaten that the judges lost count after he scored five points on me and just had us keep going for the experience.  In the end, I had no points, though on two separate times I got a hit in at the same time my sparring partner did; turns out in those situations the person who makes a bigger ‘ki-hap’ usually gets the point as they draw attention to themselves and their hit.  It was pretty frustrating, but fun at the same time.  I’m looking forward to a rematch.

Mar 032011

My son and I have been taking Take Kwon Do classes for the past year and a half or so.  We found a class that is held at the local church up the road from us.  The school of Tae Kwon Do that is being instructed is Choong Sil Kwon, the school of constant and never-ending improvement.

I just recently got my green belt which is the third promotion I’ve received (white, yellow, upper yellow, green).  Up until now promoting from one belt to another meant memorizing definitions of the forms we learn at each belt and the meaning of the belt, kicking drills, and the forms themselves.

My intent is to collect everything I need to learn onto a page here so that I can refer to it when I need to.  I also plan on including videos of the forms since it’s nigh impossible to learn how to perform them simply by reading how to do them.  Until then, I’m just going to keep on practicing.