Setting VLAN Ports on Tomato via Command Line

I have some devices I don’t completely trust to be on the same network as all my computers. SmartTVs, a surveillance system, internet enabled toasters, you get the point. (The internet-of-things is going to get a lot more people hacked and spied on in the coming years.)

I needed to set up a VLAN on my router’s Tomato install but due to some bug, I couldn’t isolate a port to a single VLAN. Despite all efforts the port would always end up being a part of both the default VLAN1 and my new, untrusted VLAN3. While the device was accessible on the subnet I wanted it to be, it could also still see the devices on my primary subnet.


After a lot of searching I found this is a bug(s) with certain router hardware (details) and/or the Tomato WebGUI. The solution being to shell into your router and do it manually.

Note: the SSH username for tomato is actually root not admin! Despite the fact that admin is your username for the tomato GUI and despite the fact that the password you set up for the GUI (probably under the username admin) is used for SSH. That’s pretty confusing.


Confusing Tomato Form

To see what ports are on what VLAN run:

nvram show|grep vlan.ports

Note the port with an asterisk is not a physical port.

To set ports on a VLAN run:

nvram set vlanXports="Y Y Y"

Where X is your VLAN number and Y is your port numbers

Then set manual boot, commit your changes, and restart.

nvram set manual_boot_nv=1
nvram commit


Posted in Hardware, Tomato | 1 Comment

This copy of OS X can’t be verified

Need to get a bootable drive to install OS X (multiple versions suffer) and immediately met the following error?:

This copy of <Some OS X version> application can’t be verified. It may have been corrupted or tampered with during downloading.”

Before you go re-imaging the drive, re-downloading the image, replacing your RAM back to OEM, or whatever else you find suggested online…. launch the terminal from the Utilities menu and set the date. Now try installing again.

The installer uses the date to try and verify the copy of OS X you’re about to install (seems dicey). If the date isn’t set, and you don’t configure the installer to use your wifi (so that the installer can make a call to a time server), the verification likely shits the bed.

The syntax for changing the date is: date <month><date><hour><minute><year>


July 14th 12:52AM 2015

mm dd HH MM yyyy

date 071400522015

Posted in OS X | Leave a comment

Capistrano authentication failure on a Vagrant VM

I was having issues getting Capistrano to SSH into a Vagrant VM. I could shell in myself but Capistrano always returned the following error:

connection failed for: (Net::SSH::AuthenticationFailed: Authentication failed for user vagrant@

Note: is my private network set up in the vagrantfile.


Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| = 'precise32'
    config.vm.host_name = 'virtualmachine' "private_network", :ip => ''
    config.vm.provider :virtualbox do |v|
        v.customize ["modifyvm", :id, "--memory", 4096]

For me, the problem only occurred with the local VM. Capistrano had no problems interacting with remove web servers via SSH.

Try changing the version of the net-ssh gem in use per this SO post. For me, locking net-ssh to 2.8.1 solved the issue. There were some Stackoverflow comments suggesting the bug reappears in newer releases.

Posted in Uncategorized | Leave a comment

Redcarpet errors when using Yard or Changing Yards markup provider

* Note, I’m not going to talk about how to make Redcarpet work. Instead I’m going to explain how to get Yard generating documentation again with a redcarpet alternative.

Maybe I’ve just been unlucky but I’ve had a number of run ins with Redcarpet when using Yard over the years. I’ve learned that Yard can use a number of markup-providers besides the Redcarpet gem.

For search purposes, here’s the verbage for my current scuffle with Redcarpet:

[error]: Missing ‘redcarpet’ gem for Markdown formatting. Install it with `gem install redcarpet`

To replace that redcarpet dependency:

1) generate a /.yardopts file if it doesn’t already exist. Any configuration you provide in there will be picked up regardless if you run yard directly or some Rake task calls yard with additional parameters.

2) Append a parameter to change the markup-provider.

--markup-provider <some markup-provider>

Screen Shot 2015-03-05 at 10.39.01 AM

More options for a markup-provider beyond rdiscount are listed at:

3) Finally, ensure your Gemfile lists your new markup-provider.

Screen Shot 2015-03-05 at 11.47.04 AM

Posted in Code, Ruby | 1 Comment

Mount a filesystem over SSH on OSX (sshfs)

1) Download & install FUSE for OSX.

2) Create an empty local folder to act as a mount point.

3) Mount the filesystem over SSH.


sshfs <username>@<IP or URL>:<remote path> <path to local mount point>


sshfs ~/Desktop/mnt

I’m not a huge fan of using Vim or Nano/Pico for lengthy editing sessions on remote servers. This allows me to use Sublime Text (or whatever your editor of choice). I’ve not encountered any latency issues and it’s much smoother than forwarding X (which I never have installed on a webserver anyway).


Posted in Code, Linux, OS X, Uncategorized | Leave a comment

OS X Command Line Tools no longer a part of Xcode.

Apple has again changed how its command line tools are packaged. Whereas it was once bundled into Xcode and then later you had to instead manually download it from within Xcode, it is now separated from Xcode altogether.

In some earlier versions of Xcode 5 you could run a command in the terminal and still get the download option to show up in Xcode but that no longer seems to be an option. At least as far as Xcode 5.1.

Now you need to download the command line tools from Apple’s developer site.


Posted in OS X, Xcode | Leave a comment

Vagrant error: Your VM has become inaccessible.

If you’ve deleted a virtual machine file still referenced by one of your projects, you’ll run into the following error when you try and instantiate the VM via vagrant up.

Your VM has become “inaccessible.” Unfortunately, this is a critical error with VirtualBox that Vagrant can not cleanly recover from. Please open VirtualBox and clear out your inaccessible virtual machines or find a way to fix them.

Vagrant creates a hidden folder within your project directory named .vagrant with files that refer to specific VM IDs.


Simply delete the .vagrant folder within your project and rerun vagrant up. Vagrant will rebuild the .vagrant directory with the correct files and ID.

For giggles, here’s a Github issue page regarding this with a few more details.

Posted in Code, Devops, Vagrant, Virtualization | 43 Comments

Skipping tests in specific browsers or Phantom.js / Grunt.js build scripts

I’m working on a project that I’ve built a very comprehensive Javascript test suite for with QUnit. I run tests a few times in a few different ways before subjecting the world to my code.

First I load the QUnit test page in multiple browsers to ensure I’m not going to be bitten by a cross-browser compatibility bug (IE). 


Afterward, when I run my Grunt build script to check, concatenate, and minify my JS, it re-runs those tests before concatenating, after concatenating, and finally on the minified version as well.

Occasionally I run into some false positives (failed tests) that are tied to some browser quirk like Chrome not allowing file cookies (unable to set cookies when the URL is local: file:///…) or the fact that PhantomJS isn’t a true browser so it isn’t able to handle cookies gracefully. Don’t skip writing tests for troublesome bits, instead just conditionally skip those tests based on user agents.

For example, I have two test helpers in a file test_helpers.js:

var helpers = {
	// Determine if tests are running in Chrome
	is_chrome: navigator.userAgent.toLowerCase().indexOf('chrome') > -1,

	// Determine if tests are running in PhantomJS.
	is_phantom: navigator.userAgent.toLowerCase().indexOf('phantom') > -1,

I include test_helpers.js file into my QUnit test page(s). Then I wrap any tests that succumb to environment issues in an if statement:

test('Session creates a session & cookie upon instantiation (TEST SKIPPED IN CHROME! WILL NOT PASS).', function(){
	if(!helpers.is_chrome && !helpers.is_phantom){
		// Test that runs only outside of Chrome and Phantom.js

My troublesome QUnit tests will run in all clients except those I’ve explicitly avoided. My tests run green in both Chrome and my Grunt build script.


Posted in Code, Grunt.js, JavaScript, QUnit.js, Uncategorized | Leave a comment

RVM error on OSX: Can not find compiler and ‘make’ tool

Running afoul of the following error when trying to install rubies with RVM despite having installed Xcode?

Can not find compiler and ‘make’ tool – make sure Xcode and/or Command Line Tools are installed.

With newer versions of Xcode the command line tools RVM expects are not automatically installed alongside Xcode.

Open Xcode and navigate to: Xcode > Preferences > Downloads and click Install for Command Line Tools.

Posted in Code, OS X, Ruby | Leave a comment

Xcode can’t be installed because Mac OS X Version N or later is required.

So, say you need Xcode installed (or updated) because you need GCC and/or other development support tools on your OS X 10.7 machine. So, you launch App Store expecting to install (or update) Xcode easily enough but are met with one of two messages telling you that you’re SOL.

No install
No update

At this point it seems like you’re forced into paying to upgrade OS X but there’s an alternative. Albeit, not an obvious one. You can download older version of Xcode if you have or create an Apple developer account. The direct link to the Xcode downloads page is:

Note: If you’re running OS X 10.7 you’ll need (as of this writing) to install Xcode 4.6.3 as Xcode 5 requires OS X 10.8.

xcode download page

It just works, right?

Posted in Code, OS X, Uncategorized | Leave a comment

Vagrant error on OSX: Command: [“hostonlyif”, “create”]

I’ve found I occasionally run into an odd Vagrant error every now and then:

There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below.

Command: [“hostonlyif”, “create”]

For me, this sometimes happens when I try to re-instantiate a virtual machine after my laptop’s battery has died and OSX has attempted to restore state. Other people seem to encounter this error under different conditions; even immediately after installing Vagrant and attempting to spin up a virtual machine for the first time.

Run the following command to bounce VirtualBox:

sudo /Library/StartupItems/VirtualBox/VirtualBox restart

and now running:

vagrant up

should go off without a hitch.

Posted in Code, Devops, OS X, Vagrant, Virtualization | Leave a comment

Python Properties Not Working Correctly?

Today I was trying to implement the observer pattern in Python, updating the observer with property methods, but my code was acting wonky. Specifically, my setter wasn’t calling a method it was supposed to be calling.

TL;DR version

If properties aren’t functioning like they should, ensure that your classes are inheriting from object. Your classes don’t automatically inherit from object (or the featured base class) in Python like in some other languages (in python this is for the sake of backwards compatibility). Use:

class MyClass(object):

instead of

class MyClass:

Long version

Here’s the basic observer pattern in Python (Notice not inheriting from object):

class ObjectOfInterest():
  def __init__(self):
    self.observers = []
    self._name = None

  def register_observer(self, observer):

  def _get_name(self):
    return self._name

  def _set_name(self, name):
    self._name = name

  # I prefer this method of setting up properties over the @ syntax
  name = property(_get_name, _set_name)

  def _update_observers(self):
    for observer in self.observers:

class Observer():
  def __init__(self, thing_to_watch):
    self.thing_to_watch = thing_to_watch

  def update(self):

Pretty straight forward, right? However, _update_observers() is never called. You will not see “updated.” printed to the console. Everything seems like it’s working; the value of name is being updated. So WTF?!

thing_to_watch = ObjectOfInterest()
observer = Observer(thing_to_watch)

print( # None = 'Bilbo'
print( # Bilbo = 'Frodo'
print( # Frodo

Remembering to inherit from object gets properties working right. Here again is the code with output but this time my classes do inherit from object and everything is right with the world.

thing_to_watch = ObjectOfInterest()
observer = Observer(thing_to_watch)

print( # None = 'Bilbo' # updated.
print( # Bilbo = 'Frodo' # updated.
print( # Frodo

This is a sloppy mistake that had me guessing for a good bit. Nothing was out of place and yet my results were borked.

Posted in Code, Python | Leave a comment

Blank Screen During Ubuntu 12.04 Install

During a Ubuntu 12.04 install your screen may go blank (purple) part way during the installation process. For me, this always came directly after setting my hostname.

The likely fix is to run the installation with nomodeset option. For details see the How to set NOMODESET option discussion. The short version looks like this:

  • From the Ubuntu menu > F6 > Select nomodeset
  • From the Ubuntu menu > Install Unbuntu

Hopefully the rest of the install process is uneventful.

Posted in Linux | Leave a comment

Getting the Diamond BVU195 USB-to-Display Adapter to Work on OS X

I’ve been pretty impressed with the Diamond BVU195 display adapter. I’ve found USB to display adapters almost universally suck. The BVU195 seems to be one of the exceptions to the rule though. It’s definitely no replacement for a video card with multiple display ports but I work on a Macbook Pro so I’m constrained.

The adapter ships with installation media but it’s only for Windows. The manufacturer’s product  page has a drivers section and even mentions Mac OS X but the download doesn’t seem to contain any actual OS X software.

Thankfully the chipset manufacturer for the product does have an OS X driver available. The driver is currently listed as a beta but I’ve been using it with OS X 10.7 Lion without issue for several months now. You can find the DisplayLink drivers here:

Posted in Hardware, OS X | Leave a comment