Some new ideas

Aug 10, 2015

Been recently working on a few ideas.


For the past two years Docker has been the big thing in devops. At Swipely, we use it from local development all the way to production. To remove any reliance on the CLI, we wrote a wrapper around the remote API: docker-api. We’ve benefited greatly from docker-api and use it in dockly and other private projects.

With Docker 1.8 just on the horizon, support is being added to copy files into a container. With that, the Dockerfile build tool is no longer reliant on the engine and can be abstracted out to a separate tool.

Rocker is a Ruby image builder that looks a lot like the Dockerfile build tool. Currently it supports only a few commands, but adding the remaining Dockerfile commands is much simpler. My plan is to support parellel RUNing, and superior caching including pulling in previous caches and rerunning a command. Rocker will share a lot in common with Dockerfile, with just a few niceties that I find extremely helpful.

App Deployer

Now, I really just don’t have a good name for this project yet. I’ve started working on something similar to aerosol for container deployment. Using a similar setup to fig, I hope to support bring up containers on a remote cluster of instances or locally. By updating a remote or local nginx upstream file, it’ll redirect requests from an old web app to a new web app. After reloading nginx, it’ll take down the old containers. I’m trying to remove the logic required to map a container port to a specific host port by updating the load balancer with the correct port after the fact. It might even be possible to load balancer TCP instead of only HTTP with nginx as well.

This one is very much in the early stages, but the DSL work is already done.


Besides these two projects, I’ve had a couple other things I’ve been working on.

Amtrak Status

Along with my daily commute from Back Bay to Providence comes the annoyance of catching the train. While Amtrak is usually on time, some days it could be more than 45 minutes late. Enter Amtrak Status.

Originally just a hubot plugin, hubot would reply with train listing after scraping Amtrak’s status page when asked: hubot amtrak from pvd to bby. This helped immensely at the end of the day when you were itching to head home. But… you had to ask. We just wanted to know.

Having written an OSX System Bar application previously, I built an application that would poll the status page every minute, giving you up to the minute timings for all trains, always visible from the system bar. A few updates later and we added the time to the top bar next to the icon. Up to the minute train times. Woo!

Until Amtrak’s status page changes…

Since everyones application was scraping Amtrak’s status page independently, if the layout changed then everyones application needed to be updated. Instead of dealing with this hassle, I wrote a gem: amtrak. The gem is powering a website: amtrak endpoint. Now if the layout changes, a few quick changes to the endpoint and everyones happy. No more relying on updates.

And for fun, I wrote an Android application around the endpoint: Amtrak Status. It’s not the prettiest right now, but I’m hoping to get an update out soon that supports push notifications when your train is late which is paired with some UI updates. Maybe someday I’ll get a real icon too!

Switching it up

Jul 17, 2014

Goodbye Ruby! Hello Jekyll!

Since this a blog and completely static, I’m switching the platform over to jekyll.

I ported over all the posts, and soon I’ll get around to working on making the layout nice.
For now, this is what I’ve got.

Yay, static websites!

Sound Jacks in Linux

Apr 4, 2014

On my desktop computer, I have a set of headphones with a microphone plugged in, and a set of speakers for when I want to watch something or listen to music and know I won’t disturb anyone.

Most computers only come with two if not one audio out 3.5mm jack.
Other than that, you have all forms of line-in, microphone and optical audio.
My headphones, which make audiophiles ears bleed they’re so awful, are plugged into the standard Line-Out and Microphone ports, but I don’t want to have to swap wires all the time and I’d really like to use my speakers occasionally.


In Windows, Realtek’s audio driver and software are awesome and give a simple interface to redirect a jack from input to output.
Double click the jack, change the functionality, instantly working.


In Linux, things aren’t so easy.
All I want to do is swap the input port for an output port.
If this was so easy in Windows, why not just as simple in Linux?
The first problem, which took longer than I’d like to admit, was trying to find the right program.

Program name?

When talking about the holes in the back of the computers where plugs are put in, I usually use the word “port”.
Instead, the program uses the word “jack”.
That was definitely the first problem.
I had opened up Xchat, connected to FreeNode, joined #pulseaudio, asked my question and in return was told to use hda-jack-retask.
Simple enough name, but just different enough from swap audio source and search terms like it.

Local PulseAudio config?

After starting up the program, I found out Ubuntu uses a $HOME/.pulse folder, instead of the Arch folder $HOME/.config/pulse.
Figured I’d just symlink .pulse to .config/pulse, right?
The program really didn’t like the symlink, so moving some folders around, symlinking in the other direction, we got everyone happy.

Just hit apply

Apply settings?

After reading online, the program is as simple as overriding the port for a different functionality.
I’m using the Blue Line In, Rear side jack, and just needed to swap this for a Line out and hit Apply now.

Blue, you're my boy!

When hitting Apply now, it told me that it had “success”.

Sweet success?

I took that for granted the first few times, but after noticing that pulseaudio was just getting killed to no benefit, I knew I had to poke around the code.
Since the code is open source at launchpad, I started poking around apply-changes.c.
The program places a script in /tmp/hda-jack-retask-XXXXXX, and somehow attempts to run it with gksudo.
Don’t have that executable, so that definitely isn’t going to run.
Removing all the previously run hda-jack-retask folders, and retrying leaves me with a that I should be able to run with sudo, and fix my audio problems.

Round one of trying script

It doesn’t error out, but as soon I try and open alsamixer and look at my audio outputs, alsamixer crashes.
Looks like something is broken.

I notice that I set the Blue Line In, Rear side to Line out (Back), but this is already taken by Black Line Out, Rear side which I don’t even have, or isn’t visible?

If I set Black Line Out, Rear side to Not Connected, and the Blue Line In, Rear side to Line out (Back), I should have success.

Round two of trying script

Script doesn’t error out again, and this time audio from my speakers!

The taste of success is sweet.