Scene from a 3d Geometry Model written with VPython:
General Tips and Notes
Using Apple's AirPrint on 10.7 Lion
I really like these instructions: rigsb enabler for airprint and will refer back to them when I need to make my own LaunchDaemons.
LaunchDaemons and GNU Screen
The GNU Screen from git will run nicely from inside a LaunchDaemon, but earlier versions (3.x) will not. To compile GNU Screen you'll need autotools, but it built cleanly when I tried this in December 2012.
Wicd with JHU 'hopkins' Wireless Network
JHU uses CCMP, not TKIP. Edit the file
/etc/wicd/encryption/templates/peap-tkip
and change TKIP to CCMP. A second tip: at the time
of this writing, they use the Equifax CA certificate:
/usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt
Xbox (Original, Xbox 1) System Link Protocol
I set up Halo and took some readings. The pre-game browser appears to w
Serial Port on DD-WRT 15320 on my Asus WL-330gE
I couldn't find a better way! (There are slightly better ways.)
svn checkout http://firmware-mod-kit.googlecode.com/svn/trunk/ firmware-mod-kit-read-only
cd firmware-mod-kit-read-only/trunk
wget ftp://ftp.dd-wrt.com/others/eko/V24_TNG/svn15230/dd-wrt.v24-15230_NEWD_std-nokaid_nohotspot_nostor.bin
./extract_firmware.sh dd-wrt.v24-15230_NEWD_std-nokaid_nohotspot_nostor.bin hackserial
cd hackserial/image_parts
cat segment2 | unlzma > segment2.edit
vbindiff segment2.edit
Here I searched for the console=ttyS0 business and changed it to ttyS1...
cat segment2.edit | lzma -6 > segment2
cd ../..
./build_firmware.sh hackout hackserial
And then I uploaded hackout/custom_image_00001-generic.bin to my router!
(Note, I had already installed picocom to my jffs2. It is also nice to have the stty or setserial
utilities. I didn't see any use in my case for the setconsole utility. stty and setconsole are
at this DD-WRT forums thread. (thanks soulstace))
The results:
WRAP THOR AI (4.0.0 build 317)
Copyright (c) 2003-2010 Bluegiga Technologies Inc.
READY.
Splitting one PDF file into many: PDFtk vs. Ghostscript
For a grad school application I needed several small PDF files but
all needed similar formatting, so I decided to write one document
in LaTeX and split it into several pieces. The first piece is two
pages long, and all the others ended up being one page.
I first used PDFtk. I ran it in six passes, extracting a page range
from the master file each time. On my Xeon X3430, it consistently took
4.2 seconds to split the files. The output file size was 372k, much
larger than the 112k input file.
I've been slowly becoming comfortable with Ghostscript, so I decided
to try using it for this basic task. I examined the 'ps2pdfwr' and
'pdfopt' scripts and their manpages to determine which options to provide,
yielding this optimal but verbose invocation:
gs -sDEVICE=pdfwrite -dSAFER -dNOPAUSE -dQUIET -dBATCH -dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/prepress -dFirstPage=1 -dLastPage=2 -sOutputFile=Purpose.pdf \
-c .setpdfwrite -f Statement.pdf
The results are much better. Ghostscript finishes all six files in under .7 seconds
and its output is 104k. At the /prepress quality level, I can't see a difference
between the input and output. Ghostscript is six times faster and produces output
that's three and a half times smaller. Fantastic! As I use GNU make to invoke it
automatically, speed and size of output overwhelm the complexty of invocation.
However, pdftk has a simpler interface and far more features. For everyday PDF
tasks, from splitting and merging to rotating just one page in a PDF, I prefer it.
Festival Speech Synthesis -- Trying out all voices
Today I installed the Nitech HTS voices by following the directions on theUbuntu forums.
I edited /usr/share/festival/init.scm so that Festival would work with
PulseAudio. These two lines need to go somewhere reasonable:
(Parameter.set 'Audio_Command "pacat --channels=1 --rate=$SR $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
I took some time afterwards to brush off my LISP skills and write a fragment
for synthesizing a the same brief utterance with each voice.
On my system, only the nitech voices work right now, so this is a bit ugly.
(let '(to-say "On the heights, one can feel the limits of >SAMPLE_TEXT_HERE<. ")
(mapcar
(lambda (voicename) (if (string-equal "" (string-after voicename "(voice_nitech_"))
(list voicename "false")
(list (eval (read-from-string voicename)) (SayText to-say))))
(mapcar
(lambda (vcel) (string-append "(voice_" (car vcel) ")"))
voice-locations)))
The Logitech C210 Webcam and Ubuntu GNU/Linux
I purchased a C210 this Black Friday, 2010, and took it apart. It comes
apart easily. There are six identical black philips head screws, two in the
back, two accessible once the front cover is off, and two holding the lens
and infrared filter assembly down over the imaging sensor. When removing
the PCB from the case, take care to gently pry the microphone out as well.
The lens assembly is lightly stuck down to the circuit board but comes off
neatly once its two screws are removed. There was a bead of glue holding
the focusing assembly in place; I easily pried it off with a hobby knife.
The IR filter is very delicate. It is cemented into the rectangular base
of the lens assembly. I made a mess chipping it out with a small knife.
It's possible the glue would melt on heating. I might try that if I were
to do this again. I destroyed the IR filter in removing it, cleaned off
the lens assembly, reassembled the camera except the faceplate, and plugged
it in.
The Logitech C210 I bought (USB ID 046d:0819) is a UVC camera with a built-
in microphone and no visible buttons.
guvcview found the camera and displayed nice video, 640x480 at 30fps in
either YUYV or MJPG format. I focused the camera. There was sufficient
range in the focusing screw to allow for the removal of the IR filter.
The image quality is noticeably poorer than a Logitech Pro 9000, and the
framerate can't match the Playstation Eye. I think the image quality is
better than my Quickcam Pro for Notebooks.
The completed ir-sensitive webcam has many uses: testing the safety of a
green laser pointer, measuring the brightness of a Wii sensor bar, or
just enjoying the milky look that irises have in the infrared.
How To Write a Full Disk .dmg File to a Block Device in OSX
It's not so obvious. First, mount the .dmg file as a block device only:
hdid -nomount /Volumes/Diotallevi/Clean\ Checkpoints/WDC\ Image.dmg
Second, determine the block device of the image and destination:
diskutil list
Third, use 'dd' with an appropriate buffer size to copy over the whole
block image including partition table and boot sector. Note that it
is extremely important on some hardware to use a large block size; you
can expect a 20x speedup over the case without blocksize parameter.
dd if=/dev/disk3 of=/dev/disk2 bs=131072
Fourth, enjoy your copied disk. I get around two terabytes a day of
transfer rate; I know of no way to skip sparse areas of the disk image,
but could approximate it by dding the first few megabytes of the image,
then using Apple System Restore to copy each volume individually.
Expect large speedups for sparse disks with this method.
What Goes On Inside kaid For Linux
The XLink system provides filtered routing based on (a) MAC address and
(b) known server-xbox. Although it also has a filtered console-only
DHCP server, this isn't important for System Link. There isn't much
compression or packet aggregation, just directional filtering.
Simple Live Streaming mp3 to the iPhone
The iPhone OS 3.0 supports background reception of Internet radio. I haven't
figured out the right container format for AAC yet, but the following VLC
command line will run its (untrustworthy) httpd. The dst= parameter defines
which local interface and port the server will listen on. It unicasts clients
the freshly-encoded ALSA input as an icecast-like HTTP stream.
vlc -I "dummy" alsa://hw:0,0 --sout-http-mime "audio/mpeg" --sout \
'#transcode{acodec=mp3,ab=128}:standard{access=http,mux=raw,dst=localip:listenport}'
Assembling several gif files into a pdf for printing
Nowadays google search results begin with advertisements for fancy Windows-only
PDF mangling tools. Say that you downloaded some files from an excellent newspaper:
wget http://graphics8.nytimes.com/packages/images/nytint/docs/eikenberry-s-memos-on-the-strategy-in-afghanistan/000{1..8}.gif
Then you converted them to postscript for ease of handling:
for a in 000{1..8}; do giftopnm $a.gif |pnmtops - > $a.ps; done
Now you could concatenate them into one postscript file, but say you want to do it the hard way:
ghostscript -sOutputFile=eiken.pdf -dPDFSETTINGS=/printer -dBATCH -dSAFER -DNOPAUSE -sDEVICE=pdfwrite -f 000{1..8}.ps
Voila! Enjoy your eiken.pdf and be sad that leaks like this make our country look bad at security.
Three ideas for undergraduate research in sensor fusion for new UI
These ideas all relate to the processing of data from infrared cameras and point sources.
The first ideas: fuse information from a high-fps infrared camera and a higher
samplerate photodetector. Option one: enrich the control possibilities of a
standard remote control by associating its motion with the button pressed.
Option two: Use rough offset information from the spatially-resolved starting
time of button presses on two separate remote controls to aid in separation and
decoding of their mixed signals.
The third idea: the Wii remote is lovely for measuring precise view angle of
the TV screen, but could we provide tracking over an entire sphere if there is
a pattern of beacons on walls and ceiling? What if there is also a camera
fixed to the room frame which observes the Wii remote?
I think all of these would be fun projects for skiled undergraduates taking EE,
ECE, HMI, optimization, or statistics classes!