Using EZCap EzTV668 DVB+ receiver for SDR on Mac OS X 10.7

There has quite a bit of buzz about the RTL-SDR project that is going on over at reddit on the rtl-sdr subreddit. Most of it has been about using the RTL2832/e4000 devices under Windows and Linux. Since I primarily use Mac OS I decided to cobble together the various hints of other people who have successfully used the devices on Mac OS and document them in a gist on github:

Update: After some feedback on reddit for the previous gist I decided to revisit my build to that I would have a more up to date version of GNURadio. After much hacking I came up with these directions for getting GNURadio 3.6.0 working on 10.7:

After following those directions you’ll want to then install the rtl-sdr driver and then gr-osmocomm so that you’ll be able to use the RTL tuner with gnuradio.

Permanently prevent OS X Mail from inserting attachments at the end of emails

OS X Mail defaults to including all attachments at the end of emails.  While useful for some file types (ZIP archives, programs, etc.), I still prefer that images be embedded exactly where I paste them in a message.

This insert-at-the-end behaviour can be disabled by unchecking an option in the Edit/Attachments menu:

Unfortunately, the option always reverts to being checked again for subsequent emails, with no obvious way to disable this behaviour permanently.  As it turns out, the solution is simple:

If you disable this option while editing an email, it will remain disabled for that message only. If you disable this option from the main window, it will remain disabled for all future messages.

Tangentially, the option to “Send Windows-Friendly Attachments” can only be toggled when you are not editing an email.  When you have a message screen open, the option is greyed out.

These options seem like perfect candidates for Mail’s Preferences menu.  Why they exist solely as menu options and why they behave this way remains a mystery to me.

Changing nginx’s worker process user on OS X

nginx defaults to running its master process as root and all workers as nobody.

You can tell nginx to run worker processes under different credentials by setting the user directive in nginx.conf.

On OS X, you need to specify a valid group as well, since nginx will default to looking for a group that doesn’t exist. You will see “nginx – getgrnam()” in the error log when this happens. The easiest solution I found is to assign the OS X staff group:

user userid staff

It probably bears mentioning that changing the runtime credentials won’t negate the need for sudo if you run your web server on port 80, since OS X (and all Unixes) will not allow nginx to use that port unless it runs as root.

Group similar apps in OS X dock with spacer tiles

OS X’s dock allows the addition of spacer tiles, blank objects that occupy the same space as an application icon.  Spacer tiles are quite helpful for organising applications into logical groups.

Adding spacer tiles is relatively simple:

  1. Launch Terminal (from Applications/Utilities).
  2. Cut and paste the following into the command line, once for each tile you want to add.  (Need 4 tiles?  Run it 4x.)
    defaults write persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
  3. Restart the dock:
    killall Dock

Spacer tiles behave like normal application icons: they can be dragged into any position, or dragged out of the dock completely to remove them.

Quitting Terminal app in Lion when the last console session ends

Lion’s Terminal app and its tabbed full-screen mode is a huge improvement for me. One thing that became a minor annoyance, however, is Terminal’s failure to quit when the last console session ends: Cmd-Q is still required to quit the app completely.

The workaround I chose takes advantage of existing muscle memory.  I had already configured an alias for exit, allowing me to type x to end a console session.

To solve the Terminal app problem, I repurposed x as a function in my ~/.bash_profile:
function x {
[ "$(w -h | grep "^$(whoami) *s[^ ]* *-"|wc -l)" -le 1 ] && osascript -e 'tell application "Terminal" to quit' || exit

The function checks for the number of active console sessions. When x is called and only one session remains, osascript is invoked to quit the Terminal app completely.

Fixing wireless issues with Asus EeePC 1000HE running Ubuntu 10.10

My Asus EeePC 1000HE netbook was recently upgraded from Ubuntu 10.4 to 10.10. The upgrade was smooth except for wireless which became extremely flaky.

The wireless connection would disconnect when I unplugged my laptop or woke it up when not directly connected to power. Attempting to disable and re-enable the wireless interface did not fix it. Even unloading and reloading the driver modules did not fix it. The only fix was to reboot.

The following two things are both required to fix wireless issues with the rt2860sta driver.

First, Ubuntu was loading unnecessary drivers for my wireless card. I addressed this by adding the following lines to: /etc/modprobe.d/blacklist.conf

blacklist rt2800pci
blacklist rt2800lib
blacklist rt2x00usb
blacklist rt2x00pci
blacklist rt2x00lib

It seems that these additional modules were interfering with the rt2860sta driver during wake up.

In addition I needed to have Ubuntu to unload and reload my wireless driver before and after going to sleep. This is done putting the following line in /etc/pm/config.d/unload_wireless

Note that the file name there is not actually important. The line just needs to be in a file in the /etc/pm/config.d/ directory.

Rebooting once after making these changes has solved the problem.

Legend of the Red Dragon on DOSEMU on Linux

In setting up a yet to be announced BBS system I discovered that Legend of the Red Dragon does not work on Ubuntu 10.04 Server installation under DOSEMU. When I ran the config program LordCfg it would fail with the following error:
This version of LordCfg is not meant for your version of Lord

When running the start.bat script or lord.exe it would fail with this error:
# Firing Up LORD.OVR
# Using EMS for faster overlay swapping.
Internal error #38019
Cannot continue.

I did few preliminary searches for these errors on Google and finding only complaints about them. I contacted Gameport which currently distributes the game and they pointed me to an obscure link on the authors website which has a patch for this bug.

The url to the patch for this issue is:

There is also single forum posting on the authors site about this issue as well but it lacks useful keywords to make it findable. That forum posting is here:,196

Hold Calls on iPhone 4/4S

The Hold button was replaced with FaceTime on iPhone 4’s call menu.
You can still place calls on hold: just tap and hold Mute for 2 seconds.

List all Facebook friends who use iPhones

Facebook’s iPhone app seems to integrate with the Facebook Platform using the same rules that other applications must follow. After you sign in to the iPhone app for the first time, a corresponding Facebook app, Facebook for iPhone, is automatically granted access to your profile.

There is nothing unusual about this; Facebook is merely playing by their own rules. But there is an interesting side effect.

Facebook is a social platform, so all application pages allow you to list other friends using that app. Facebook for iPhone, the Facebook counterpart for the iPhone app, is no different.

These are all your Facebook friends who use (or once used)…

It is worth noting that the Facebook for iPhone app remains in your profile until you explicitly remove it, so results may be misleading.  (After all, how would Facebook know that your iPhone fell into the toilet, when you may simply not have run their app for a long time?)

If any of this bothers you, breathe deeply… then get off the internet.

And my lawn.

Access OS X clipboard from CLI

Accessing the OS X clipboard (or “pasteboard”) from the CLI is made simple with the pbcopy and pbpaste commands:

cat ~/ confidential_information.txt | pbcopy
pbpaste > confidential_information.txt

The pbcopy/pbpaste manpages have more detailed information about their use.

An interesting footnote to OS X’s clipboard system is that there are actually four pasteboards, each assigned to its own, unique purpose. The Find clipboard is particularly useful because it enables search queries to be saved automatically between applications. To test this, enter a string in (for example) Firefox’s search box. Don’t copy it to the clipboard. Now open your text editor and start a new search. The same string should already be in the dialog box…