Ubiquiti, I Think I’m in Love

For as long as I can remember, I’ve had a home network problem. While I truly enjoy the simplicity of Apple’s Airport Extreme wifi router, I often need some features that it doesn’t offer, e.g., command line interface, a web interface, dynamic DNS support, easy static dhcp mapping for dozens of clients, simple local “DNS,” etc. On the flip side, there are many high-end routers that will give you this an much more, but you need a Ph.D. in Cisco hardware to make sense of them. My typical workaround usually involved offloading network tasks to Linux servers. It works, but in most cases it felt heavy for a home network. About a year ago I bought a Netgear Nighthawk R7000 and flashed dd-wrt onto it. This was a nice step forward, but the whole dd-wrt community is a bit of a hack. With every firmware update something gets better, but something else breaks. It’s cool, but not reliable.

Ubiquiti EdgeRouter PoE

Ubiquiti 5-Port EdgeRouter PoE

And then about a month ago I found Ubiquiti while reading an article on SmallNetBuilder. It sounded too good to be true, “enterprise hardware at consumer prices.” For the price, I couldn’t resist ordering one to see. I decided on the EdgeRouter PoE. Small, silent (no fans), built-in switch, it seemed to have the essentials. Continue reading

Severe Hand RSI Pain and Recovery

It’s been over a year since I wrote something on my site. It’s not because I got lazy or disinterested. It’s because my hands hurt. They hurt like I never knew they could. After months of trying to determine the issue and subsequent rehab, they’re manageable, but still not great.

I’m writing this post with the intent of informing two types of people: 1) in-pain people: if someone out there is feeling the sort of pain I describe in this article hopefully it will help expedite successful diagnosis and recovery, 2) pre-pain people: if you’re twenty-something and feeling invincible, I’m here to tell you you’re not.
Continue reading

Update MacPorts via rsync Behind a Firewall Over SSH

Update: I found an even better approach to update over https. What’s not so clear in that link is to use sudo port sync instead of sudo port selfupdate for subsequent syncing. (29 Oct 2014)

If you’re stuck behind a firewall and can’t access rsync to update MacPorts, but ssh is available and you have a server on the Internet, here is a quick fix (assuming you have MacPorts installed)

Step 1: Update the MacPorts config

While quite simple to change, this config option took me a while to find. Credit to Nikolas Mayr.

$ vim /opt/local/etc/macports/macports.conf

Find the line with “rsync_server” and change to this (or whatever port number your prefer):

rsync_server		localhost:12345

Step 2: Tunnel to your server

Nothing fancy here. Just open an SSH tunnel to forward rsync traffic through your server.

ssh -L 12345:rsync.macports.org:873 -lyour_user your.server.example.com

That’s it.

Systems: Because You Can’t Count That Fast

Me trying to explain a global SAP ERP network to kids.

On Thursday, it was bring your daughters and sons to work day at Genentech. My little Marlowe is only 6 weeks old so I didn’t bring her, but my VP shot me a note Wednesday saying she was bringing her two boys, knew of some other kids who would be there, and wondered if I could give a 30 minute talk on systems. I responded, “sure.”

But what the heck do you tell kids ranging from 6-12 years old about your corporate ERP system? While fascinating, I doubt they’d care about the usual things that I work on and I wouldn’t dare show them PowerPoint slides. So what to do?

Continue reading

Hello Marlowe!

Allow me to introduce to the world, Marlowe Maxine McBride!

Marlowe was born in San Francisco, California at the University of California San Francisco (UCSF) hospital at 12:23pm on Sunday, 10 March 2013 (10 + 3 = 13 … yay! A math trivia birthdate!). She weighed in at 7 pounds 7 ounces, and measured 21 inches in length.

Both Alicia and Marlowe are doing great and getting a lot of needed rest. Marlowe’s middle name is borrowed from my paternal grandmother. Her first name was her mom’s top pick and after witnessing the process of giving birth, mom had final decision rights on the name. Luckily, when we both gave our final suggestion on what her name should be around noon on the 11th (24 hours after her birth), we both agreed Marlowe matched her personality.

For those of you looking for more pics, I will upload highlights by day to the link below for the first week or two, so check back each day for more:

Click for Marlowe Pics!

Cleanup Unused Linux Kernels in Ubuntu

I update Ubuntu with a very simple script I call apt-update that looks like this:

$ cat ./apt-update 
sudo apt-get update; sudo apt-get dist-upgrade; sudo apt-get autoremove

Nothing too crazy there. It updates the apt-get cache, performs the upgrade, and then removes all the residual junk that’s laying around. Well, almost all. If you do this enough, eventually you’ll see the following (assuming you’ve got the default motd Ubuntu script running and you’re logging in from a terminal):

=> /boot is using 86.3% of 227MB

This is because that script I mentioned doesn’t consider old kernel images to be junk. However, unless you’ve got an abnormal /boot partition, it doesn’t take too many old images to fill it up.

A quick Google search found Ubuntu Cleanup: How to Remove All Unused Linux Kernel Headers, Images and Modules. The solution on the page had exactly what I’m looking for, however, I couldn’t take it at face value. While the article offers an adequate solution, it doesn’t offer much explanation. The remainder of this article explains the details for this one-liner noted in the article above:

$ dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

Note: Only run this if you’ve rebooted after installing a new kernel.

Ick. Let’s dig into what’s going on here. The pipe characters are chaining a bunch of commands together. Each command’s output becomes the input for the next. Given that, let’s walk through what’s going on in 3 steps.
Continue reading

Remove Chromatic Aberration With Lightroom

I was chatting with Karen Yang last week about photography and she mentioned that she uses Photoshop to open each of her photos individually to edit them. As I’m a huge fan of all of the powerful one-or-two-click tweaks in Lightroom, I thought I’d note one here that I fixed over the weekend and hopefully begin to help Karen see the Light … room. :)

The issue I ran into with my photo is called chromatic aberration. It’s a term that simply means not all colors of light had the same focal alignment when captured. Chromatic aberration usually can be seen by colors bleeding out on the edges of subjects in your photos. Check out this shot of me as an example:

Continue reading

Managing A Large Photo Library With Lightroom, Dropbox, and Crashplan

Late last year I made the switch to Adobe’s Lightroom 4 from Aperture and Picasa for a variety of reasons, but a big one was photo/file management. As my photo collection got larger I found that I’d need more than my laptop’s hard drive to store them all. Despite all the things I liked about Aperture and Picasa, both had clunky file management and the burden was enough to make me consider alternatives. I’m now very happy with the workflow described below using Lightroom, Dropbox, Crashplan, and a Linux file server.

What I Want to Accomplish

I want my setup to enable the following:

  1. Mobile Photo Management: To be clear, when I say “mobile,” I don’t mean smartphone. I take my Canon 5D Mark III everywhere and like to transfer photos to my Apple MacBook Pro immediately. It’s important that I be able to do whatever I need to do no matter where I am, i.e., I don’t want to be tied to my office.
  2. Large Photo Archive: Photos (especially RAW photos) consume a lot of disk space. I want a file server to store any photos that I’m not actively working on. It has to be huge and scalable.
  3. Passive Transport: I want my files to get to my file server as quickly as possible, but I don’t want it to be an active part of my workflow, e.g., I don’t want to get stuck waiting on a FTP program to finish its batch before I can disconnect from a wifi spot or put my computer to sleep. I’d rather it just happen when the opportunity arises.
  4. One-Time, Offsite Backup: Once my files are on the file server, I want them to back up from the server only (i.e., I don’t want my laptop doing a second backup). Also, as I’ve noted before, I like offsite backup of my photos. A local copy isn’t good enough.
  5. Accessibility. When home, I want to easily access all of my photos, whether they’re on my laptop or in the archive.

Sound like a lot to accomplish? It turns out it’s pretty easy to do. Continue reading

Stop Taking Lossy JPG Screen Shots for Text in OS X. Use PNG.

If you take a lot of screen shots in OS X using the built-in screen capture functionality (e.g., cmd-shift-4) and present them to other people, you should really consider changing one of the default OS X settings. This is especially true if the content contains a lot of text. To be clear about what I mean, consider these two captures of a random gDoc form:

Lossy capture using JPG:

Lossless capture using PNG:

You can probably see the difference quite clearly. The jpg looks blotchy and the color of red has been distorted. This is because the JPG format will degrade image quality to produce a smaller file. Given that we’re talking 9 vs. 13 KB in this case, the savings don’t really matter. What does matter is that the image looks terrible and makes you look oh-so-non-tech-savvy.

The solution is quite simple if you’re using OS X. Simply change the default format for screen captures. Launch the Terminal app and issue the following commands:

$ defaults write com.apple.screencapture type png
$ killall SystemUIServer

That’s it! All of your screen captures will now be in the much cleaner PNG format. If you decide you’d rather have JPG again, just replace “png” with “jpg” in that first command.

Controlling Movies in QuickTime Player X (10.1) With AppleScript

The following works for Quicktime Player X (10.1) in OS X 10.7 (Lion). It takes arguments from the command line and opens a movie, resizes it, sets the volume, and starts playing the movie (there are other properties you could add). Hopefully this is useful for someone like me who was trying to find examples of this, but only finding mounds of info for QuickTime Player 7 (and earlier), which doesn’t help much as many of the properties have changed.

-- AppleScript to open and control movie files in QuickTime Player X

-- The script is meant to run at the command line, like so:
-- $ osascript /path/to/movie.mp4 movie.mp4 800 60
-- If you don't want to use a shell, just remove this and 
-- the last line and manually populate the first 4 variables
on run argv
	set movieFile to item 1 of argv -- the full path with movie filename
	set movieName to item 2 of argv -- the file name only of the movie
	set desiredWidth to item 3 of argv -- the width of the movie on the screen
	set startOffset to item 4 of argv -- how many seconds into the movie to start
	-- this finds the right side of the screen, then offsets to the left
	-- the desired width of the movie
	tell application "Finder"
		set desktopBounds to bounds of window of desktop
	end tell
	set rightX to item 3 of desktopBounds
	set leftX to (rightX - desiredWidth)
	tell application "QuickTime Player"
		-- open the movie and bring it to the forefront (if other movies are open)
		open movieFile
		set lastOpenedWindow to (first window whose name contains movieName)
		set visible of lastOpenedWindow to true
		-- resize the movie using its original aspect ratio
		set movieBounds to bounds of lastOpenedWindow
		set widthOrigin to leftX
		set heightOrigin to 1
		set originalWidth to ((item 3 of movieBounds) - (item 1 of movieBounds))
		set originalHeight to ((item 4 of movieBounds) - (item 2 of movieBounds))
		set calculatedHeight to (round ((desiredWidth / originalWidth) * originalHeight) rounding down)
		set desiredWidth to (desiredWidth + widthOrigin)
		set calculatedHeight to (calculatedHeight + heightOrigin)
		set the bounds of lastOpenedWindow to {widthOrigin, heightOrigin, desiredWidth, calculatedHeight}
		-- if opening multiple movies, ensure they don't overlap
		set slideDown to 1
		repeat with aWindow in (get every window)
			set boundsOfAWindow to bounds of aWindow
			set heightOfAWindow to item 4 of boundsOfAWindow
			if (heightOfAWindow > slideDown) then
				if (name of aWindow does not contain movieName) then
					set slideDown to (heightOfAWindow + 1)
				end if
			end if
		end repeat
		set the bounds of lastOpenedWindow to {widthOrigin, (heightOrigin + slideDown), desiredWidth, (calculatedHeight + slideDown)}
		-- note, here we select a document, not a window
		set myMovie to document 1
		tell myMovie
			set audio volume to 0
			set current time to startOffset
			activate -- makes QuickTime Player the frontmost application
		end tell
	end tell
end run