Python CIDR Block Converter December 14th, 2007

I wrote a Python script that converts a CIDR Block into a list of individual IP addresses, one-per-line. I found that I needed to repeat some network-related tasks across an entire subnet, and this script provides an easy way to automate these kinds of tasks in a shell environment. The source code and sample usage for the script follow:

Source Code:

Sample Usage:

brandon@zodiac ~ $ cidr

One item to note is a key difference between the way this program computes a CIDR block and others I have seen. The lazy way to convert a CIDR block to a list of IPs is to calculate the number of IP addresses in the subnet, (2^(32 – $subnetSize)), and simply increment the base IP address that number of times. This method is deficient because, as in the example usage above, the base IP address that is specified may fall somewhere in the middle of the range of IP addresses (not necessarily at the beginning).

In my script, I calculate the CIDR block members the correct way. I am converting the base IP address to its binary form, zeroing-out the number of least significant bits as specified in the subnet size, and starting the enumeration of IP addresses at the bottom of that range.

Play Dark Castle in Windows December 13th, 2007

Update: 13-Dec-2007

I’ve found an old image of Beyond Dark Castle that is compatible with the version of Mini vMac we are using below! I added it to the existing archive, Now you can simply drop the ROM file, BDCImage.hfv into the running emulator and be off to the races with the equally legendary sequel. Enjoy.

Dark Castle was one of my favorite games to play on the old mid-1980s Macintoshes like the Mac Plus. I spent some time last year looking for a version I could run in Windows, but with no success. A few weeks ago I discovered a tutorial for running Dark Castle via a Mac emulator. I felt it was a bit confusing and left something to be desired, so I decided to put together a one-stop shop for playing Dark Castle in Windows.

All the files you will need are in the archive

  1. Unzip the archive.
  2. Run the Mini vMac.exe executable. Mini vMac is is a Mac Plus emulator which is freely distributed. Mini vMac requires a ROM image from a Macintosh Plus to run, which I’ve provided as well.
  3. Once you’ve executed Mini vMac.exe, you are effectively running a Mac Plus with no operating system installed. I consolidated some of the steps in the above mentioned tutorial and created a disk image with System 6 already installed. Go to File > Open Disk Image within Mini vMac and open the file Disk603.dsk or drag the file into the vMac window.
  4. Now that System 6 is up and running, it would be useful to have a hard drive available to install software and save data to. Just like the previous step drag the included file, hfs10M.DSK into the vMac window to mount the 10M hard disk image I pre-loaded with the Dark Castle software.
  5. That’s pretty much it. Run the Dark Castle executable to start the game.

Enjoy the game! If you’re anything like me, it should be a nice trip down memory lane. Let me know if you have any questions about the game play.

Next on the list of Mac games I would like to resurrect is Lode Runner

East Bay Psychotherapist
Licensed Clinical Social Worker provides psychotherapy and counseling services for couples and individuals in the East Bay Area.