The Wayback Machine - https://web.archive.org/web/20081216003725/http://alex.polvi.net:80/

Get around EC2 filesystem limits (sort of)

December 12th, 2008

Tonight I got myself pretty excited about an EC2 hack. Essentially I was able to create arbitrarily sized root filesystems, when the limit was supposed to be 10GB… or so I thought.

A little background. Amazon AWS allows you to make custom machine images to boot their “elastic compute” (EC2) nodes. Essentially they are a giant file with the entire OS in it. The file gets slapped on their virtual servers and booted. You can create these images with tools that AWS gives you. The images are limited to 10GB, which means your root (/) filesystem can only be 10GB in size.

Normal Example:

root@domU:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 1.4G 8.0G 15% /

I was investigating how the tool that created the images worked. After poking around with the build script, I noticed that the max size was hard coded. “Hmm, I wonder what happens if I just increase this…” I figured if the file size protection would be else where in the stack, like in the upload part, or when you actually register the image with AWS.

Anyway, the image built without a problem … then it uploaded, no problem … and then it registered with AWS! At this point I was pretty excited, but then I remembered I still had to boot the thing. Guess what?

It booted!

root@domU:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 521M 47G 2% /

That’s a 50GB root file system! “I’m such a hax0r.” Well, at least that’s what I thought — up until I wrote out an 11GB file and the filesystem went read-only then crashed the box. Looks like AWS did the filesystem size limit in the kernel and/or the hypervisor. Good idea AWS … “bummer, not a hax0r, just ignorant.”

Lessons learned:

  • You can write out an 11GB file, not 10GB, so you actually can get an extra 1GB off EC2 if you poke
  • It’s a smart idea to handle your OS restrictions in the kernel, not in your API (right on, AWS!)
  • Still not a hax0r

Getting cache statistics with mod_cache

December 4th, 2008

The always awesome Paul Querna came up with a cool trick to log cache hits/misses. In your virtual host set the environment variable SetEnv CACHE_MISS 1, then log it using your CustomLog with %{CACHE_MISS}e. It will log as “1″ when it is a miss, or as “-” when it gets hit.

How does it work? To quote Paul:

20:36 < @pquerna> as the setenv command runs in fixup hooks
20:36 < @pquerna> which is after the Quick Handler
20:36 < @pquerna> that mod_cache uses

Mostly just noting here so I don’t forget in the future … Thanks Paul!


Police Scanner and GNURadio

November 9th, 2008

Keeping and eye on the police has never been so much fun! Recently, my friend John lent me his USRP, allowing me to play with GNURadio. From wikipedia:

The Universal Software Radio Peripheral (USRP) is a high-speed USB-based board for making software radios.

USRP

GNURadio is a free software, software radio. Essentially, the USRP allows you to tune or transmit any radio signal, given the correct tuner/transmitter attachment. Currently it is anything in the 0-5.9Ghz range. The USRP John lent me came with a FM/TV tuner — meaning I can listen to anything between 80Mhz and 800Mhz.

What exists between 80Mhz and 800Mhz? Lots of stuff! For example, normal FM radio is between ~87Mhz - 108Mhz, all of which can be demodulated using GNURadio. Also, analog TV transmits in that range, allowing you to watch or listen to any of that on your computer.

But! It gets even more interesting. For instance, San Jose International Flight Control exists around 124Mhz (although, I have not heard much there…). Or, you can even listen to Police Central at 460.4Mhz. Listening to the police has been pretty fun. So far, Sam and I heard about a stabbing at a local restaurant, and plenty of phone number / license plate checks.

Anyway, so far I have not done much hacking on the device — there are a lot of example applications to do the FM demodulation. The one thing I did figure out was now to remove the FM static when the channel is not in use. It took me awhile to figure out, mainly because I did not know the correct terminology. Turns out, the term is “squelch“, and gnuradio implements a block to do this. All I had to do was create a squelch handling block, put it as part of the rest of the processing chain. Looks something like this (inside the usrp_wfm_rcv.py example program):

squelch = gr.simple_squelch_cc(0, 5e-3)

Then add the squelch to the rest of the connect chain:

self.connect(self.u, squelch, chan_filt...

This thing is super cool — and I’m excited to see what else I can make it do.


Hungry Scientist in the NYT

October 29th, 2008

Check it out! Pat’s book was on the front page of the dining section in the New York Times today! I went down to Borders to get a copy, and while I was there did a little clean up of the “Reference” section…

Before:
hungry1

After:
hungry2


Net Nightly News 2008-10-24

October 24th, 2008

This is a hack I’m working on … trying to grab the daily news from the web and make an episode.


Videobooth shell script

October 23rd, 2008

Just a quick note to point out my, now open sourced, videostrip generator.

My dream goal would be able to generate these using a webapp and then let the site grow. I originally implemented a flash recorder, but now my flash trial has expired and I am unable to continue messing with it. Guess that means it is time to start hacking on a firefox-addon/ogv/icecast stack to replace the existing flash-plugin/flv/flash-server stack! It’s 2008, why is flash still the only solution for streaming video out to the web??


Makers Faire timelapse, using CHDK and mencoder

October 22nd, 2008

Last weekend I went to Austin, TX, for the Makers Faire. There, Pat, David, and I make a crap load of custom ice cream scoops. The process involved filling a dixie cup with whatever ingredients you wanted, including fun stuff like chayanne pepper and BBQ sauce (some people made normal ice cream, too), and then instantly freezing it with liquid nitrogen. The kids loved it!

Just as a note, this was a promotion for Pat’s just published book, the Hungry Scientist Handbook. The book is meant for foodie/geeky types — I’d definitely check it out if you self identify with either of those groups.

Anyway, I made a timelapse of the setup. Here, you can see us getting ready and serving for about half a day (then my battery died).

After discovering CHDK, I’ve started messing with timelapses. Here is how I created the above timelapse:

  • Installed CHDK on my Camera
  • Added this script to my CHDK/SCRIPTS directory
  • Set it to take a picture every 15 seconds, and run it until the battery runs out
  • Copied all the resulting photos off my SD card into a folder on my computer
  • Ran the following command (requires mplayer): mencoder "mf://*.JPG" -vf scale=640:480 -o timelapse.avi -of lavf -ovc lavc -lavcopts vcodec=mjpeg -lavfopts format=avi
  • And tada! You now have timelapse.avi.


Videobooth project

October 14th, 2008

I’ve been casually hacking on a videobooth project that will generate videostrips (analogous to photobooth and printing photo strips). Here are the full results of the free culture conference, where I got to test the system out last weekend. Check it out at, videobooth.me/fc2008/.


Free Culture Conference in Berkeley, Oct 11th & 12th

September 26th, 2008

Mozilla’s own John Lilly will be teaming up with Prof. Lawrence Lessig and Prof. Pam Samuelson to key-note (yep, 3 different keynotes) at the first ever Free Culture Conference. If you’re available October 11th and/or 12th, I would highly recommend you check it out!

fc

Should be a great conference. I’m particularly excited to meet up with other Free Culture activists.

See you there!


Eye-fi Video Support using CHDK

September 11th, 2008

Yesterday I demoed this to the team at Eye-fi, and they said I was the first person to show them video sent over wireless from a consumer camera (+eye-fi). One of the first implementations of wireless video on consumer cameras, I’m pretty stoked! It means you can use your cheap Canon camera to auto post data to youtube, or some other video sharing service.

If you are not familiar with Eye-fi, it is a special SD card that allows you to upload photos over wireless as you take them. It does not, however, upload videos as you take them. This is because it only looks for valid JPGs. I was able to achieve video uploading by creating a spoofed JPG with CHDK that embedded the video. Eye-fi uploaded the JPG, then the AVI was decoded client side.

To use this, you will need to make sure your camera is supported by CHDK (see table on the homepage). I’ve posted the patch over on the CHDK forums. You can get a built firmware for my camera (SD700IS) here.