Raspberry Pi as a thin client

 The processor on the Raspberry Pi isn't all that fast, so why not offload it? I have a HP ML350 that is mostly idling, except when I need to use PostgreSQL, so I thought to set it up as a desktop server for my Pi.

 

I set up a RDP server since it works well with Linux and also Windows. First thing's first, install xrdp and all other dependencies:

 

apt-get install build-essential libpam0g-dev libssl-dev x11vnc vncviewer fakeroot checkinstall x11vnc xrdp rdesktop

 

Then, install your desktop of choice. I chose XFCE since it's pretty lightweight

apt-get install xfce4

I've had problems getting it to start X remotely, so I fixed it with the following. Do this in the user's account (/home/pi for example)

 

touch .Xauthority

chmod 600 .Xauthority

NES controller on the Raspberry Pi

Because I wanted the full experience, I wanted to hook up my NES controller to my Raspberry Pi and play NES games. I looked around and didn't find anything that fit my needs.

I wrote a script, that's up on Github now, that converts button presses on the NES controller to keyboard presses. So for example, by pressing the A button it registers as pressing the Z key on a keyboard. How to set it up is all right here.

I spliced the wires on the NES controller (thanks to this diagram) and used a breadboard to connect the appropriate wires to ground, +5V, the data, latch, and clock pin. Now I can play Mario in retroarch with a NES controller!

SNES emulator on the Raspberry Pi

 I won a Raspberry Pi for getting 3rd place in the Open 7400 Logic Competition, of which HubCityLabs donated the Raspberry Pi. My initial project idea for it was to set up a wall mounted weather station. For the time being I thought I'd mess around with it and get somehwhat familiar on what I'm dealing with.

 

I downloaded the Rasbian image and wrote it to an SD card. It's recommended that the SD card is a minimum of class 4.

Update: iStat on pfSense

 

pfSense 2.x runs on FreeBSD 8, instead of the previous 7. I wanted to get istatd working on my router, so I fetch'd libxml2 from here and the istatd binary (version 0.5.7) compiled against FreeBSD 7 from my previous blog post, here. For this to work, you'll also need the iOS app. When running istatd, it complained about some libraries. I simply created symlinks from the old library to the new one and everything worked fine, see below.

ln -s /lib/libz.so.5 /lib/libz.so.4
ln -s /lib/libkvm.so.5 /lib/libkvm.so.4

You can get a template for the configuration file here and put it in a nice place, like /etc/istat.conf 

Create your user, group and socket file and you're good to go:

pw user add -n istat
pw useradd istat -G istat
touch /tmp/istatd.sock

Then, you can run the istatd daemon with just

istatd -d -c /etc/istat.conf

 Now, you'll be able to monitor your pfSense box with iStat!

 

 

DeLicate Linux, still usable at 166Mhz

Linux, one way or another, really brings out your inner hacker. I've been tinkering quite a bit with DeLicate Linux. It's a lightweight distro made for old computers that uses the 2.4 kernel. Right now, I have DeLicate running on a Pentium 166 with 64MB of RAM. Surprisingly, Fluxbox and Xchat run without any huge problems. Replacing Bash with Dash helped free up some RAM as well. DeLicate uses pacman as the package manager, so building new packages is as easy as creating a PKGBUILD file.

I have also set up a DeLicate package repsitory and a Git repository for the PKGBUILD files.  So if you have an old Pentium laying around, go fire it up and check out DeLicate. There's an active community too.

4000 series CMOS 24 hour clock

 For the last couple months a friend and I have been working on a 4000 series based clock in electronics class. After having failed building a FM receiver, we opted for a clock. We didn't go the microcontroller way, but old school ICs. So, we created a circuit for a simple clock. I opted for a 24-hour version, while my friend made the 12-hour equivalent. 

The above image was the basis of the circuit. Not shown was a 4060 and 4013 IC to make a nice 1Hz signal which we can use for the seconds. The rest is fairly simple: allow the seconds and minutes to count to 59 and use AND gates to reset at 60. Also pictured is the buttons to set the time. We used two 2N2222 transitors to make a NOT gate. Though, this ended up being too glitchy so I opted for a 4011 to create stable square wave.

Pasteros is now on Github

I recently put Pasteros up on Github [link], the text storage service. What was once a singular file is now a collection of models, views and controllers. You can see it running here: paste.gelat.in. Feel free clone the repo and use it for your own projects.

Of course, it's not made as a turnkey solution so tables need to be created. Pastes can be forked and also compared to the parent paste (diff). It' has also been a huge stepping stone to not writing such terrible code, at least that's what I think.

Using Xdebug with NetBeans 7

There comes a time where it's unacceptable or inconvenient to stash var_dump() into your code. And then there's Xdebug. Xdebug makes it easy to debug your PHP application and with the intergration of NetBeans, it's even easier.



For the record, I'm using Debian 6.0.4 on my workstation and Debian Wheezy/Sid on my dev server.

First of all, lets install Xdebug on the server:

pecl install xdebug

Open up your xdebug.ini file, mine is located at /etc/php5/cgi/conf.d/xdebug.ini, and enable Xdebug. My xdebug.ini looks like this:

zend_extension=/usr/lib/php5/20100525+lfs/xdebug.so

xdebug.remote_enable=1

xdebug.remote_connect_back=1

xdebug.remote_handler=dbgp

xdebug.remote_mode=req

xdebug.remote_port=9000

xdebug.idekey=netbeans-xdebug