VIVAHATE

Ralink RT2870/RT3070 in Debian 6 (Squeeze)

About a year ago, I got this cheap-o USB 802.1n wireless adapter for $15. lsusb reports the device as: Bus 002 Device 002: ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter. In theory, this adapter should be supported out of the box using the rt2870sta module. Of course, just working would be too easy.

To get the wireless adapter to work, we first have to blacklist a few kernel modules.

NOTE: While these instructions are for Debian 6, they should apply to most Debian-based distributions.

Create the following files in /etc/modprobe.d:

$ cd /etc/modprobe.d
$ touch rt2800lib.conf rt2800pci.conf rt2800usb.conf rt2x00lib.conf rt2x00pci.conf rt2x00usb.conf rt61pci.conf

Next, add the following to each file. replacing the name of the module you want to blacklist as necessary (the pattern here should be obvious):

$ cat rt2800lib.conf
blacklist rt2800lib

Next, we need a couple packages. First, install wireless-tools. This should be available on your install media.

$ sudo apt-get install wireless-tools

Next, install the firmware-ralink package. Assuming you don’t yet have an internet connection, you probably won’t find this on your install media as it’s in non-free. I downloaded the package on another computer, transfered it over on a flash drive, and installed it manually.

Reboot. Cross your fingers.

Connecting

# aptitude install wpasupplicant
# iwlist wlan0 scan
# nano /etc/network/interfaces

Add the following:

auto wlan0
iface wlan0 inet dhcp
        wpa-ssid ESSID
        wpa-psk PASSPHRASE

Bring up the interface.

# ifup wlan0

A Simple Chat Room in Node.js

In this post, we’ll be building a simple chat room using node.js. Here’s how it’ll look:

Getting Started

Install node, socket.io, and express

First, make sure you’ve installed node.js. You’ll also want to grab a copy of the socket.io library and the express framework. These can both be installed with npm via the express and socket.io packages.

Directory Structure

Before we cover each file in detail, here’s how everything fits together. Place the chat directory wherever you like, mine is in ~/projects/chat.

$ ls -R chat
chat/:
public  server.js

chat/public:
client  index.html

chat/public/client:
socket.io.js

server.js

index.html

Coming Soon…

Next time, we’ll bring canvas to the party. Here’s a preview of what we’ll be building in the next installment:

McMurdo

Lately, Cyclops and Max have been watching the McMurdo Station Webcam. They requested this script after they got sick of saving images manually and searching for ways to animate them.

Uses the excellent Beautiful Soup library, which makes HTML parsing a snap. The program saves images named 1.jpg, 2.jpg, etc. every few seconds. Because the filename on this partiular webcam changes with each new image, we have to rescrape the page each time we want a new image.

Cyclops runs Windows, but this stuff should run wherever Python and ffmpeg are available.

mcmurdo.py

encode.bat

Videos


Mesquite Smoked Turkey Leg with Barley and Spring Onions

Nyx 0.0.2

What’s New?

  • Nyx is now hosted on GitHub
  • Vertex buffer objects
  • Supports Python 3
  • OBJ model support

Example

Screenshots

304,135 triangles. The transparency is just so that we can see a little more detail.
Since there’s no support for lighting yet, without the transparency all we’d
see would be a silhouette.

Notes

The OBJ loader is implemented in 18 lines of Python. There is no error checking and it only supports vertices and triangles, but it loads models exported from Blender just fine. Neat.

Gumballhead Inspired WPA

http://www.homebrewtalk.com/f70/gumballhead-inspired-wpa-92976/

About the Recipe

Recipe Type
Extract
Yeast
S-05
Batch Size (Gallons)
5
Original Gravity
1.054
Final Gravity
1.010
Boiling Time (Minutes)
60
Color
orange-golden
Primary Fermentation (# of Days & Temp)
9 @ 62
Secondary Fermentation (# of Days & Temp)
14 @ 68
Tasting Notes
Excellent american hop flavor and aroma, with a full, smooth wheat body

Recipe and Instructions

  • 1lb. Caravienne
  • 1lb. 2-row
  • 1lb. White Wheat
  • 5lb. Briess Wheat DME
  • .5oz Amarillo whole (9.8 AA, 60 min.)
  • .5oz Amarillo whole (9.8 AA, 15 min.)
  • .5oz Amarillo whole (9.8 AA, 5 min.)
  • .5oz Amarillo whole (9.8 AA, flameout)
  • 1oz Amarillo whole (9.8 AA, dry-hop)
  • 1oz Simcoe pellet (12.1 AA, dry-hop)

Brewing Notes

Used White Labs WLP320 “American Hefeweizen” yeast.

Pitched at 60°f (which is cold for this yeast).

Started primary in an ancient 5gal Pyrex carboy (my grandpa used it to make wine back in the ’60s). Unfortunately, the closest size bung plug I could find didn’t fit snugly, and at the end of the first day of fermentation I was greeted after work by a rather large amount of krausen spilling out from around the plug. After some fucking around, I decided the best course of action was to cut my losses and rack to a 6gal plastic bucket.

This also allowed me to leave behind the hops, which I originally neglected to strain out of the wort.

After racking to the bucket, fermentation continued as expected, but the volume of wort is now slightly less than four and a half gallons.

OG was six point high, probably because I failed to account for the volume of the plug hops.

Dry hopped with 1oz each Simcoe and Amarillo hops on 12/23/2010.

Hydrometer Readings

12/12/2010 (OG)
1.060
12/23/2010 (Dry Hop)
1.020

Tasting Notes

Coming soon…

The Innkeeper

About the Kit

This beer was brewed from Northern Brewer’s limited edition kit, The Innkeeper.

“…Spicy, herbal, and English biscuits. Flashes of clean citrus and chewy minerals blend into a complex finish that is refreshingly bitter and remarkably dry…”

Brewing Notes

Primary fermentation started in 6gal glass carboy on 12/04/2010, with an original gravity of 1.045.

Bottled on 12/23/2010. Yeast has reached 80% attenuation, which seems extremely high given that the Wyeast 1469 is only supposed to reach 67-71% attenuation.

Hydrometer Readings

12/04/2010 (OG)
1.045
12/23/2010 (FG)
1.009

Attenuation

((1.045 – 1.009) / (1.045 – 1.00)) * 100 = 80%

St. Paul Porter

About the Kit

This beer was brewed from Northern Brewer’s St. Paul Porter kit.

“NB’s hometown gives its name to our robust porter kit – an assertive black ale dominated by roast-coffee and chocolate character and hop bitterness. Toffee-like maltiness and citrusy hop flavor are in there as well, with a medium-full body and lingering roast malt/hop bitterness before a bittersweet finish. We like spiking barbecue sauce with a splash of this porter; it’s also great with strong cheese like sharp cheddar or Stilton.”

Brewing Notes

Primary fermentation started in a 6gal glass carboy on 11/26/2010, with an original gravity of 1.060.

Racked to 5gal glass carboy for conditioning on 12/4/2010 (8 days).

Hydrometer reading on 12/8/2010 (12 days) was 1.022. Assuming fermentation is complete (there’s been minimal airlock activity since racking to secondary), this puts final gravity at 4.99% ABV.

Attenuation was 64%. Attenuation for this yeast (Wyeast 1187 ”Ringwood Ale”) is supposed to be 68-72%.

It’s possible that the porter dropped a few points between when I last took a hydrometer reading and when I bottled. Sadly, I lost the FG reading, so I’m not sure exactly what the apparent attenuation was.

Fermentation temperature was in the low to mid 60s.

Coconut Cake

No-Knead Bread

Bacon Wrapped Meatloaf with Black Truffle-Saffron Macaroni and Cheese

sliced

Ingredients:

  • Meatloaf (recipe below)
  • Black truffle-saffron macaroni and cheese (recipe below)
  • 8 slices apple wood smoked bacon

Instructions:

  1. Preheat oven to 375f.
  2. Lay bacon across the width of a loaf pan. The bacon should be long enough to drape over the sides of the pan while lying flat across the bottom. If this is unclear, see the picture below.
  3. Press a layer of meat into the bottom of the pan, on top of the bacon. This layer should fill exactly 1/3 of the loaf pan.
  4. Scoop some of the macaroni and cheese into the loaf pan, making sure to press out any air bubbles. This layer should also fill 1/3 of the loaf pan.
  5. Form a slab of meat in the approximate size and shape of the remaining 1/3 of the loaf pan. Transfer the slab to the loaf pan. Add or remove meat as necessary to ensure a snug fit.
  6. Fold strips of bacon back over the top of the meatloaf.
  7. Roast until internal temperature reads 160f.
  8. Note: It may be necessary to pull the loaf out every 30 minutes or so to drain the fat. This keeps the loaf from turning into a greasy mess.

Meatloaf Mixture

Ingredients:

  • 2 lbs ground meat (we used 1 lb of ground chuck, 80% lean, and 1 lb of spicy pork sausage)
  • 2 slices of wheat bread, crumbled
  • 2 eggs
  • 2 tbsp ketchup or to taste
  • 1 large clove minced garlic
  • 1 1/4 cup sliced onion (sweated)
  • 2 tbsp minced parsley
  • Worcestershire sauce to taste
  • Cayenne pepper to taste
  • Salt and black pepper to taste

Instructions:

  1. Mix meat, eggs, breat, ketchup, garlic, parsley, Worcestershire sauce, cayenne pepper, salt, and black pepper with hands in a large bowl.
  2. Meanwhile, sweat onions until translucent but not brown. Allow onions to cool and add to meat-mixture.
  3. Cover bowl with plastic wrap and move to refrigerator.

Black Truffle-Saffron Macaroni and Cheese

Ingredients:

  • 1 lb elbow macaroni
  • 1 lb extra sharp cheddar cheese
  • 4 oz Romano cheese
  • 4 oz Asiago cheese
  • 8 oz organic heavy cream
  • 3 cups organic whole milk
  • 6 tbsp unsalted butter
  • 6 tbsp all-purpose flour
  • 1 small black truffle
  • Pinch saffron threads
  • White pepper to taste (a little goes a long way)
  • Nutmeg to taste (just a little, always use whole nutmeg)
  • Salt and black pepper to taste

Instructions:

  1. Boil macaroni in a large amount of salted water until al dente. Drain and rinse with cold water. Set aside.
  2. In a large saucepan, melt butter.
  3. Over medium-low heat, whisk flour into butter, making a roux.
  4. Whisk heavy cream and milk into roux until thoroughly combined.
  5. Add saffron.
  6. Add cheese slowly, whisking constantly. Adding the cheese too fast or slacking on the whisk will result in a gross, lumpy disaster.
  7. Add shaved truffle, nutmeg, salt, and pepper.
  8. Fold macaroni into cheese sauce.


UPDATE: Here it is on the Today show (skip to 3:10)

Node.js on Mac OS X

Installation

First, install Mac OS X and Xcode. Install Homebrew:
$ sudo chown -R $USER /usr/local
$ curl -Lsf http://github.com/mxcl/homebrew/tarball/master | tar xz
  --strip 1 -C/usr/local
Install Node.js and Express:
$ brew install node
$ brew install npm
$ npm install express
Add the following to ~/.bash_profile:
export NODE_PATH="/usr/local/lib/node/"
You can verify that NODE_PATH has been set correctly by running the node program and inspecting require.paths. You should see something like this:
$ node
> require.paths
[ '/usr/local/lib/node/'
, '/Users/kyle/.node_libraries'
, '/usr/local/Cellar/node/0.2.3/lib/node'
]
> require('express');
{ version: '1.0.0rc3'
, Server:
   { [Function: Server]
     super_: { [Function: Server] super_: [Object] } }
, createServer: [Function]
}

Sample Program

Test it out. Put the following in a file named test.js:
var express = require('express');

var app = express.createServer();

app.get('/', function (req, res) {
    res.send('Hello World');
});

app.listen(3000);

Run It

Run using node:
$ node test.js
And visit http://localhost:3000/ in your browser.

Up Next…

Here’s what we’ll be building in the next post:

Node.js on WebFaction

Installing Node

I was able to build Node successfully on my WebFaction host using the following:

$ ./configure --jobs=1 --prefix=$HOME
$ make
$ make install

All set

$ node --version
v0.2.3

Testing Node.js

I created a custom app in the WebFaction control panel and mapped it to a subdomain, http://node.purslane.webfactional.com/.

I then dropped the following into a file named test.js:

This is simply the basic HTTP server example from the Node.js website, tweaked slightly to include the port that WebFactional chose for my custom app.

Where you put the code isn’t important. I saved it to ~/webapps/node/test.js. Seemed as good a place as any.

Running the server:

$ node test.js
Server running at http://node.purslane.webfactional.com/

Visiting the URL in my web browser resulted in the expected Hello World message.

Object Oriented JavaScript

The Constructor Invocation Pattern

function Greeter(opts) {
  this.who = opts.who;
};

Greeter.prototype.greet = function() {
  document.writeln("Hello " + this.who);
};

var g = new Greeter({who: "Kyle"});

g.greet();

Prototypal Inheritance

if(typeof Object.beget !== 'function') {
  Object.beget = function(o) {
    var F = function() {};
    F.prototype = o;
    return new F();
  };
}

var greeter = {
  who: "Kyle",
  greet: function() {
    document.writeln("Hello " + this.who);
  }
}

var anotherGreeter = Object.beget(greeter);
anotherGreeter.who = "Frank";
anotherGreeter.greet();

Southwest Breakfast

Chorizo patties and a fried egg on a thin cornmeal biscuit. With pico de gallo and avocado.

Almond Torte

Quiche

A Simple Node.js TCP Server in CoffeeScript

First Attempt

tcp: require 'tcp'

onConnect: ->
    socket.write 'hello\r\n'

onData: (data) ->
    socket.write data

onEnd: ->
   socket.write 'goodbye\r\n'
   socket.end()

server: tcp.createServer (socket) ->
    socket.setEncoding 'utf8'
    socket.addListener 'connect', onConnect
    socket.addListener 'data', onData
    socket.addListener 'end', onEnd

server.listen 7000, 'localhost'

Second Attempt

class Server
    constructor: ->
        @server: tcp.createServer (socket) ->
            socket.setEncoding 'utf8'
            socket.addListener 'connect', -> socket.write 'hello'
            socket.addListener 'data', (data) -> socket.write data
            socket.addListener 'end', -> socket.write 'goodbye'
        @server.listen 8000, 'localhost'

server: new Server()

Shrimp with Thin Spaghetti

Unsorted

« Older Entries     Newer Entries »