Category: Hacking

Minecraft Server Query Library

Posted by – December 8, 2011

I’ve just published a new github repository that includes a simple library and tool for querying basic information from Minecraft servers. This library will let you determine if a server is online, what the MOTD is, how many players are currently logged in, and what the player limit is.

SimpleDesktops

Posted by – December 13, 2010

I’ve become fond of several desktops on http://www.simpledesktops.com/. Since they’ve got lots of cool stuff, I wanted to fetch a bunch of wallpapers and rotate through them periodically on my laptop.

In the future, I’ll use their RSS feed to subscribe to new and interesting releases. In order to fetch a small collection of previous images, I whipped up a bit of python:

Head on over to SimpleDesktops for nifty backgrounds like Cloud Storage and others that you might be missing out on.

Happy Halloween

Posted by – October 31, 2010

Halloween Pumpkins

DD-WRT and a Xbox 360 – DHCP Mishaps

Posted by – October 27, 2010

NOVO XBOX 360

Sometime earlier this month I started noticing more frequent problems with my internet connection at home. Flash back to June of this year, our local Frys Electronics had a sale on the Netgear WNDR3700. I had done a quick search in store and found that the WNDR3700 was supported by DD-WRT, so I picked one up. I may have been a bit overexcited and flashed the device with the latest build without fully reading what could go wrong. Several users have reported problems with wireless signal strength after flashing the unit. Reverting back to stock firmware doesn’t seem to fix the problem, and you end up stuck with a wireless router with terrible range. As time progressed, the WNDR3700 seemed to degrade even further, dropping long lived TCP connections, and hard-locking on occasion. In order to get reasonable 802.11b/g range, I was forced to use an old router as a dumb access point, as the WNDR3700′s signal barely reached 15ft away from the unit before clients dropped their connections.

Back to today: As a potential fix, I looked to the DD-WRT router database for advice on a replacement router. My requirements included gigabit Ethernet, dual-band (a/b/g/n) radios, and alternative firmware support. There are sadly few devices that meet this mix of features, but I settled on the Linksys E3000. Users were reporting fairly good wireless range, and reasonable stability. When the router arrived, I removed the WNDR-3700 and the old router providing 2.4Ghz connectivity. I was confident that this new device would fill the void left by the old and broken hardware. DD-WRT setup was a breeze, following instructions on the wiki. Once the new router was up and broadcasting, old wireless devices associated and I was able to connect to the internet without issue. Everything had gone well with the upgrade, or so I thought.

Early in the honeymoon period with the WNDR-3700, I was using OpenWrt. I was unable to get a UPnP daemon running that my Xbox 360 approved of. Often Xbox Live connections failed to work properly as the required ports were not opened on the routers firewall. Remembering those problems, I decided to test the Xbox 360 with the new E3000 to make sure there would be no unforeseen problems in the future. I powered on the Xbox, and turned on our projector. By the time the projector warmed up, the Xbox had already booted and was waiting at the dashboard. Sadly, the Xbox reported that I was not automatically signed in to Xbox live. This situation was tell-tale of UPnP problems with the old router, so I checked the UPnP administration page on the E3000, but no connections to the Xbox were opened.

I attempted a connection to Xbox Live manually, but the Xbox threw an error, recommending I run its network diagnostic wizard. The wizard blinked and chirped for a while, then decided that the console could not acquire an IP address. Strange, I thought, as numerous other devices on our home network were able to connect without issue, and get fresh DHCP leases. Looking at the DD-WRT status page, I could see that the Xbox’s MAC Address had a recently requested DHCP reservation. I initially thought it was a transient error, so I gave the Xbox another shot. It once again came back with the ‘could not acquire an IP address’ error. I tried a couple more things — setting a DHCP hostname, entering a new MAC Address, rebooting the router and Xbox, and even switching Ethernet cables. I eventually assigned the Xbox a static IP, and things started looking up; the Xbox could now connect to the Internet, but complained that the firewall settings were awry. This change in luck lead me to focus on DHCP as the source of my problem.

I finally decided to fall back on the Internet for advice. After a bit of poking around, I found this helpful DD-WRT forum post.

Tim.Lad: Check the DHCP lease times are not set to 0 or Blank the 360 will not take an ip address if the lease time is 0

Jumping back to the DD-WRT administration page, sure enough, my DHCP lease time was set to 0. I changed it to 5, applied my changes, and ran the Xbox connection test once more. Everything worked perfectly.

Arduino Powered Signal Towers

Posted by – October 25, 2010

Over the weekend, my roommate and I made a trip to HSC for some random hard-to-find parts. Looking around their back room, I spotted a box of surplus industrial signal towers. There were many different varieties, I picked up the above unit still wrapped in bubble wrap inside a plastic sleeve. Another open unit had power ratings marked on a sticker — 24V AC/DC 1.5W max per stack. For $20, how could I say no?

I picked up a few Aromat TQ2E-5V Relays, as I had planned to control this contraption with my newly arrived Arduino Unos. The Aromat relays don’t have an exact datasheet available online, so I found a compatible datasheet for the Panasonic branding of the same model.

Once I got everything home, I opened up that Patlite unit. I noticed it had what appeared to be a speaker or buzzer inside the vents below the color Blue. Peering down inside, there appeared to be a bit of protoboard stuffed inside as well. Taking the whole thing apart was easier than expected — the screw on top of the unit releases all of the colored lenses. Each lens is backed by an array of LEDs of the same color. All colors appear to have the same number of LEDs with the exception of blue — as the blue LEDs are exceptionally bright. Once I got down to the buzzer and protoboard, I found a series of KBP204 rectifiers, a capacitor, and a piezo buzzer. I had planned to power the Patlite unit with a spare 12V 2A wallwart so I removed the entire protoboard, and connected the leds directly to the cable coming out of the bottom of the unit. Some quick testing showed the wallwart to provide more than enough power to light up the LEDs with plenty of brightness.

I wired everything up on a breadboard. The Arduino uses 4 digital output pins to switch the relays at 5V. My first attempt to get everything working, I found that I had inverted the polarity of the relay coil. Instead of making a resounding click — they made a very quiet chirp. After a bit of trial and error, everything was sorted out, and the light was all ready to go. I wrote a very simple extension of the LED blink example code, to randomly turn the color modules on and off. The TQ2E’s produce a satisfactory musical click as the coils energize, so it is quite pleasing to run the random pattern for testing. You can find a video of the Patlite unit and the breadboard, along with the full photo gallery after the break below.

More

Home Theatre Device Control

Posted by – October 25, 2010

Home theatre devices do not like to play nice together. They each use separate protocols and methods for command and control, and finding documentation or sample code on how they work is often difficult.

I have written two small libraries and put them up on GitHub for devices I have come in contact with:

The code for the Viewsonic Pro 8100 will let you control every feature documented in the manual over a serial connection. Reading data back from the projector is not yet fully functional, however.
The code for the Onkyo Receiver should be compatible with other Onkyo devices using their ISCP protocol over Ethernet. With a bit of elbow grease, that library should also be useful for those wishing to control their Onkyo serial devices.
If you find either library useful, please drop me a note — and patches are always welcome!

IPv6

Posted by – March 11, 2010

The past few weeks have been jam packed with academics and post-grad job hunting, so I’ve had little time to play around with technology. This week, in a few hours of time, I deployed IPv6 in my school research lab, the research lab webcam, and my colocated server (this blog). My domain name, compbrain.net, now has both an A record and an AAAA record. I’ve noticed that machines with 6to4 IPv6 addresses tend to pick the IPv4 A record over the IPv6 alternative when both records are available.

Thanks to Hurricane Electric’s IPv6 Tunnel Broker, setting up these IPv6 networks was fairly painless. The only real exception here was in my dorm room, as our residential network filters inbound ICMP (inbound anything from the public net really) and prevents Hurricane Electric from allowing a tunnel to be created. To work around that, i’m using 6to4 on my DD-WRT powered WRT310N. The DD-WRT docs have a decent writeup on 6to4 available here.

Fireplace Temperature Sensing

Posted by – January 9, 2010

Currently it is quite cold in New England, Google says about 28F in my home town. Our house has a wood burning stove in the basement that we like to keep burning so the room is about 70F. With the help of some python from Mikal Still, and some left over one-wire serial experiments, I have a working prototype to keep an eye on the fireplace performance.

A bit of Python polls owserver using a SWIG module and commits the read temperature value to a MySQL database. I munged some of Mikal’s graph server code to simply post the chartserver URL to appengine so it could be hosted for the world to see.

qmmp

Posted by – December 6, 2009

I’ve gotten to rather like qmmp. It offers a nice balance of simplicity and functionality, and has the added benefit of being modeled visually after my favourite windows based media player, winamp. To make this style more complete, i’ve added the official Winamp base skin.

QMMP with Winamp base skin

QMMP with Winamp base skin

The classic skin came from here. Just download the .zip and place it in ~/.qmmp/skins, open up the settings, make the switch, and you’re good to go.

UPDATE: Cups class physical destination

Posted by – December 5, 2009

Not that long ago I was searching for a way to find the printer a job sent to a CUPS class printed to. After poking around on the cups.org forums, Michael Sweet responded with information about the “job-actual-printer-uri” IPP attribute.

The code is something like:

self.cups = cups.Connection()

def getActualPrinter(self, jobid):
job_attributes = self.cups.getJobAttributes(jobid)
return job_attributes['job-actual-printer-uri']

Now with the added code, I’ve added physical destination to the CCIS print queue viewer. We have several queues that all point to the same printer (name-simplex, name-duplex, etc all point to name). The same code for identifying destination on print classes also works for these cases.

Print Queue Viewer

CCIS Print Queue Viewer