OpenBSD 5.1 Packages for Node.JS Stable
I have started building stable node.js packages for OpenBSD 5.1. I will upload them here as I build them.
Currently 0.8.2 is available for amd64 and i386.
Let me know if there are any issues!
Installation via packages
pkg_add -v http://deftly.net/files/OpenBSD/5.1/{amd64,i386}/node-0.8.2.tgz
These packages are using the files from ports/lang/node on -current
Installation via ports
If you would prefer to install via ports, I have supplied a tar.bz2 with the lang/node files in it here
Apply and install with:
cd /usr/ports/ tar -jxvf/node.tar.bz2 cd lang/node make install clean
OpenBSD on a CR-48
OpenBSD pd-ksh on OSX
To install OpenBSD's pdksh on linux - you can simply download the source from
here, but for OSX, it's a bit more complicated:
1. First download the package listed above.
2. Then download pmake ( I used the unstable version from Debian ).
3. Apply this patch to pmake.
4. Patch and bootstrap pmake.
cd pmake patch -p1 < pmake-osx.diff make -f Makefile.boot ./bmake5. Patch openbsd-pdksh with this patch.
6. Build openbsd-pdksh!
7. .....magic!
8. VICTORY!!!
Vi Keybindings for rtorrent
Here is a patch I created that makes rtorrent ( 0.8.7 ) use vi style key bindings.
I found another patch from 2005 here. But it doesn't patch agains 0.8.7
patch. :D
Lil OpenBSD Router

Aww
Using a picoLCD 256×64 on OpenBSD
The first thing you will notice if you connect your fancy picoLCD 256×64 to your OpenBSD box, is that it shows up as a Human Interface Device.
Unfortunately libusb doesn’t know what to do with devices on bsd systems that are NOT using the ugen driver:
464 if (strncmp(di.udi_devnames[0], "ugen", 4) != 0) 465 /* best not to play with things we don't understand */ 466 continue;
Fine libusb! We will have to come up with another way to use this screen! OR! We could tell OpenBSD to use ugen when ever it sees the lcd!
To do that – you need the the OpenBSD source, knowledge of how to build Open’s kernel, and my patch! Getting the source is beyond the scope of this little post.. so you will have to rtfm that action.
cd to the usb source directory: cd /usr/src/sys/dev/usb
Download the patch ( md5: 85e7498826635c612ede672f5e295e7a ): picoLCD256x64.patch
Apply said patch: patch -p1 < picoLCD256x64.patch
pkg_add libusb
Compile your kernel, install and reboot!
Once you are running your freshly compiled kernel, download the lcd4linux-256×64 source from http://picolcd.com/drivers/ . Apply this patch ( md5: 3852103e3e5a13a3cd6b0c49389688f6 ): lcd4linux-256×64.patch, compile ( You will have to play around with the plugins as some of them use linux’s proc fs and are not compatible with OpenBSD ).
Now check out the sample config files and have fun!
Concurrent Hello with Erlang
I recently picked up a copy of Joe Armstrong’s superb Programming Erlang book ( from the folks @ pragprog.com ). While reading the chapter on concurrent programming I was completely stumped by one of the examples. It basically creates a “server” and “client” and allows for message passing between the two. I found it very difficult to follow the passing of messages from a to b, and back.
Enter chello.erl! I created a slightly modified version of Joe’s example that uses some io:format to tell you what’s going on. Hope someone finds this useful.
-module (chello).
-export ([loop/0, rpc/2]).
rpc(Pid, Request) ->
io:format("rpc[~p] sending ~p to ~p~n", [self(), Request, Pid]),
Pid ! {self(), Request},
receive
Response ->
io:format("rpc[~p] responding with : ~p~n", [self(), Response]),
{Pid,Response}
end.
loop() ->
receive
{From, {hello}} ->
io:format("loop[~p] received info from: ~p~n", [self(), From]),
From ! {self(), "Hello"},
loop();
{From, {goodbye}} ->
io:format("loop[~p] received info from: ~p~n", [self(), From]),
From ! {self(),"Goodbye"},
loop();
{From, Other} ->
io:format("loop[~p] received info from: ~p~n", [self, From]),
From ! {self(),{error, Other}},
loop()
end.
Run with:
1> Pid = spawn(fun chello:loop/0).
<0.38.0>
2> chello:rpc(Pid, {hello}).
rpc[<0.31.0>] sending {hello} to <0.38.0>
loop[<0.38.0>] received info from: <0.31.0>
rpc[<0.31.0>] responding with : {<0.38.0>,”Hello”}
{<0.38.0>,{<0.38.0>,”Hello”}}
