Heads Up: Migratory Internet Junk

If you haven’t heard of TGIMBOEJ (The Great Internet Migratory Box Of Electronics Junk), you should definitely check it out. The basic idea is that a box of random electronic junk gets shipped between makers and tinkerers, each of whom take something and contribute something to the box, and document what they end up doing.

To make a long story short, I was recently offered a chance to receive one of these migratory lending libraries, so expect to see something in this space about it soon.

More Mandelbrot

I just recently revisited the M-Set code from my Perl Snippets post. The code I had was pretty ugly, so I decided to rewrite it in Python. The result is not only a lot cleaner and easier to understand, but it’s also a lot faster:

$ time python mandel.py > \dev\null
real	0m0.051s
user	0m0.036s
sys	0m0.010s
$ time perl mandel.pl > \dev\null
real	0m3.518s
user	0m3.463s
sys	0m0.029s

You can find the code here.

This script works well for zooms, as long as you stay below a few thousand iterations. The following picture was generated with x=-1.1887204, y=-0.3032472, width=0.01 and 150 iterations.

Conky Calendar with Date Highlight

Since I got a new desktop a month or so ago, I’ve been running Ubuntu as my main operating system, and am using Conky for a nice heads-up-display. There are a lot of articles on the web about both Ubuntu and Conky, but one thing I couldn’t find a good, accurate how-to on was getting a calendar that highlighted the current date. While getting the calendar is easy using the cal command, actually getting the date highlighted is somewhat hard, and all of the articles I found suggested methods that broke in various situations. However, I managed to get it all worked out, and have a beautiful calendar that looks like this:

After the jump, I’ll give you the code and explain how it all works. Continue reading

Perl Snippets

I’ve been getting into a mood lately that makes me fiddle around with fun Perl stuff, but sadly school’s picking up to the point that writing anything up isn’t going to happen. However, I have a couple short scripts that I’m just dying to share.

Just Another Perl Hacker

I figured that it was about time in my hacking career (read: I was bored enough) that I should make a japh script. After a couple attempts I came up with this:

 	for (map{ord($_)-33}split ''){

print "\n";

                   /|                        |\
      !            ; :                        : :
                  | Y,                      ,P |
     !             |  Yb.        __        ,dP  |
                  l\  YMMb,_ _,/  \,_ _,dMMP  /f
  !                 j;  `YMMP'  `--'  `YMMP'  ;j
                   : \   YP`-._    _.-'YP   / ;
  !            !      \ `\,  _,\_    _/,_  ,/' /
                     `,_,   \`o>  


I'll let you go ahead and figure it out on your own. It's not super-hard, but it's fun.


In another fit of boredom I decided that it was finally time to create a mandelbrot set renderer. I originally tried to make one of these in basic, long before I had the math to do so. I was proud that I got the real axis to render, and figured it was time to complexify it. To keep things simple I decided to make it render an ASCII-art version of the set that would fit in a terminal window. The output looks like this:


The code's far from polished and not what I like to publish, but it's a fun thing to look at and offers you some neat abilities to poke things around and fix some pesky problems that just need clear thinking applied to them. It's available here.

GPSd under OS X

Update 7-13-11: I’ve posted an updated set of instructions on getting GPSd to compile on OS X here; this post will remain for archival purposes. For information on installing GPSDrive, see this post.

So I recently picked up a cheap GPS module on Amazon. It was about $30 with shipping, and I got a neat little dongle which connects over USB to my computer and communicates with software. It didn’t come with support for OS X (although interestingly enough it shipped with Mac OS 8 and 9 drivers), but it promised to send generic NMEA-0183, so I wasn’t too worried.

When it showed up, some quick software probing revealed that it houses a usb to serial adaptor (a Prolific PL-2303, which I’ll get to in a bit) and a gps module that’s configured to send NMEA strings through the virtual serial port. This sort of information is compatible with a host of software, but most of it is commericial, and only available at a considerable price.

Luckily, there’s a wonderful open source project called gpsd which provides support for a wide raft of devices and protocols, and talks to an even wider assortment of software. Primarily, I wanted to be able to get my gps to talk to the network scanner Kismac, and Randall Munroe’s cyborg.py script. Both of these were built to take information from gpsd, so I was in business. However, gpsd, which is designed to play nicely with Linux, takes some coaxing under OS X. This is meant to describe how I got it all running. Continue reading

Genetic Algorithms in Perl

Inspired by recent genetic algorithms floating around, I decided to try my hand at implementing one in perl. I’d thought for a long time that it would be quite difficult, but really it’s quite easy. My biggest hangup was dealing with data structures, but once I did that, it turns out that all you really need is a few functions:

  • A fitness function, that determines which individuals are most fit to reproduce
  • A mutate function, that will add random chance into each generation
  • A breed function that allows the best individuals to reproduce.

I ended up implementing a very simple algorithm, but it’s fairly fast and very generic โ€“ it can be easily adapted to just about any task. Sadly, I have no fascinating application just yet, but if I stumble across one, I’ll be sure to post about it.

After the jump, I’ll put up some of the code I used and a link to the script, all for your viewing pleasure.
Continue reading

Fast and Simple Stock Quotes Using Perl

One of the things that makes perl so powerful and fascinating is the huge number of modules that are available online, especially through the CPAN repository. Today I stumbled upon one called Finance::Quote, which does one thing, very simply: it retrieves stock (or mutual fund) quotes. You feed it a ticker symbol and it gives back a hash with all sorts of information, but most importantly, the price. I’m going to show how to use this to create a command line tool that will grab an up-to-the minute stock quote for any ticker symbol you give it.

Continue reading

Obama Buttons!

B4D3442D-F39D-49F1-A049-5996E9495255.jpgGuess what? MoveOn.Org is giving out FREE Obama buttons!

We’re giving away new Obama buttons for free, as part of a massive national visibility campaign. Want one? Click here:


After you’ve gotten yours, forward this email on to everyone you know so that they can get free Obama buttons too.

If hundreds of thousands of us wear these wherever we go, we’ll send a strong message that Barack Obama is the candidate with the buzz, momentum, excitementโ€”and sincere support of regular folks across the country.

Everybody should pick one of these up and wear them!

A Call to All New Yorkers

Friday, August 8, there’s going to be an event to commemorate the 1988 uprising of the Burmese democracy movement, as well as a call on Burma to move to a more democratic form of government. The event will also welcome two students (who I’ve had the pleasure of meeting and working with) who will have walked almost 3000 miles from Portland, Oregon to New York, bringing signed petitions to the United Nations.


Invitation to Participate in Event to Commemorate 20th Anniversary of 8-8-88 Uprising

We, the 88 Generation Students in Exile (88 GSE), National League for Democracy, Liberated Areas, USA Branch (NLD-LA), Women on the Move for Burma (WOMB), and International Campaign for Burma โ€“ New York (ICB-NY), would like to invite all members of the public as well as interested organizations to help us plan and organize an event to commemorate the upcoming 20th anniversary of the 8-8-88 popular uprising in Burma. The event will be held on Friday, August 8, 2008. A tentative outline of the dayโ€™s activities is presented below.

Tentative Schedule for Friday, 8 August 2008

12PM โ€“ 2 PM (Burma Consulate General)

2PM โ€“ 3PM (March from Burma Embassy to the United Nations)

3PM โ€“ 7PM (Dag Hammarskjold Plaza, United Nations)

In addition, we will be hosting a welcoming event for Ko AThein and Ko Zaw Min Htwe of 88 Generation Students. Ko AThein and Ko Zaw Min Htwe have been walking across the United States from Portland, Oregon to the United Nations (nearly 3,000 miles) in an effort to raise awareness of human rights violations in Burma.

If you or your organization would like to join us in organizing these important events,

please contact the below-listed individuals by July 12th, 2008.

Event Contacts: Aung Khant (516-808-1515)

Aung Min Tun (917-425-7809)

Khin Sandi (917-445-9222)

Thant Zin Myint (347-229-6355)