Jason Meridth's Blog Learn, Converse, Share

Why I started programming

I’ve been interviewing a lot lately since I was let go from my last gig. During the interviews I’ve been asked a few times when and why I started programming. My answer is the following:

  • I wrote my first program in the Basic programming language when I was eight years old (1988) and loved that I could control a computer and build software.
  • In 1991 when QBasic came out I learned about the easter egg that you can do when starting QBasic from a DOC prompt. The easter egg showed “The Team of Programmers” that created QBasic. Once I saw that, I told myself I wanted to be one of them.

QBasic Team of Programmers Easter Egg

  • The idea of learning another business industry so I could create software for them excited me. Here are some of the industries I’ve learned through my career:
    • Banking
    • Oil & Gas
    • Hosting
    • Medical
    • Daycare
    • Salon
    • Restaurant/Service
    • E-Commerce
    • Sports Merchandise
    • Home Security

Getting Going With Docker

UPDATE: Looks like this post is moot as of today 3/24/2016 due to Docker for Mac and Docker for Windows betas coming out

While interviewing for a new gig I was asked to use memcached and they had suggested standing up a docker instance. I have been using docker pretty regularly now after learning much from my previous co-workers and practical usage.

So, on OSX you can install the docker-machine and docker brew formulas with homebrew. (If you are not using homebrew and cask to manage your installations on OSX you are missing out). I use VirtualBox as my VM hosting tool.

If you haven’t installed (tapped) cask for application (non-CLI, GUI apps) installations, you should do it now:

brew tap caskroom/cask

Now install the items:

brew cask install virtualbox
brew install docker-machine docker

On Linux you don’t need docker-machine as you can just use docker directly, but on OSX you need the set up a Linux host through a VM tool like Virtualbox. You need to setup your docker-machine with the following command:

docker-machine create --driver virtualbox default

This creates the docker host on virtualbox and names it default. So when you run docker-machine ls you will see something like the following:

› docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
default   *        virtualbox   Running   tcp://           v1.10.3

I created a Dockerfile to create the docker image with the following content:

FROM ubuntu:latest
MAINTAINER Jason Meridth <jmeridth@gmail.com>

RUN apt-get update && \
    apt-get install -y memcached && \
    apt-get clean

EXPOSE 11211

CMD ["-u", "root", "-m", "1000"]
USER daemon
ENTRYPOINT memcached

This Dockerfile will do the following:

  • create a new image based on the latest Ubuntu docker image on DockerHub.
  • set the maintainer to myself
  • update the instance
  • install memcached
  • cleanup the update/install
  • expose port 11211 from the instance
  • run the arguments against the entry point (memcached)
  • set user to daemon
  • set entry point to be memcached

After the docker host is create I then built the image with the following command:

docker build -t memcached_img .

-t lets you set a tag on the image so you can use that instead of the unique ID when creating the instance.

To see the new image you run the following:

docker images

and you’ll see something like:

› docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
memcached_img       latest              ad3d86685ca8        57 minutes ago      211.4 MB
ubuntu              latest              97434d46f197        4 days ago          188 MB

Note: To delete the image you would use the docker rmi memcached_img command.

I then created the docker instace based on the new docker image with the following command:

docker run -name memcached_ins -d -p 45001:11211 memcached_img

You should receive the sha of your new container instance. To see the instance information run docker ps. The result is

› docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                      NAMES
18c82cd27a2d        memcached_img       "/bin/sh -c memcached"   5 seconds ago       Up 5 seconds>11211/tcp   memcached_ins

As you can see this shows the mapping from the host port of 45001 to the container instance port of 11211 (defaul for memcached).

Note: You may need to add the -a argument to the docker ps command to see all container instances (including the ones not currently running).

Good Leadership Advice

From a former colleague at Rackspace, whom I asked for his top leadership advice:

  • you work with me, not for me
  • consult rather than dictate
  • manage to the outcome
  • understanding how you are communicating is just as important as what you are communicating
  • treat everyone the same

Meta keys with iTerm and Weechat

Found this tip today about how to ensure your iTerm console sends +Esc to weechat for the meta keys to work properly.

To make alt key bindings behave well for Mac OS X iTerm2, go to Preferences->Profiles->Keys and click +Esc radio button for option keys.

I like to use meta+c to clear a buffer and meta+x to close a buffer. meta for me is the Alt key. Here is the keybindings in my .weechat.conf.

Using PushBullet for Notifications in Android/Chrome

So I recently got my weechat (IRC) notifications coming to my android via Pushover. I just borrowed the following infomation from my friend Major’s blog post. It was working great, but then Major told me about Pushbullet on Twitter and it’s integration with Chrome and everything else that I alredy use. I finally set it up and noticed that the pushover.pl plugin that I was already using in WeeChat works with Pushbullet also. So minimal change to my already existing Weechat setup (just needed to set service = “pushbullet” and pb_apikey attributes on the Pushover.pl plugin and I was good to go. The pushbullet Chrome extension is awesome. Try it out if you’re looking for a way to get notifications between your compute and your Android device. I wanted it for when I marked myself as away on IRC I would get notifications on my browser and my phone.

How I set it up:

  • Create your pushbullet account on https://www.pushbullet.com
  • Get your access token from https://www.pushbullet.com/account
  • Inside your weechat setup, install the pushover script:
/script install pushover.pl
  • Configure the plugin
/set plugins.var.perl.pushover.enabled on
/set plugins.var.perl.pushover.only_if_away on
/set plugins.var.perl.pushover.service pushbullet
/set plugins.var.perl.pushover.pb_apikey [ACCESS TOKEN FROM ABOVE]

Next time you /away yourself, you will receive IRC notifications where you’re mentioned on your device/browser. You can also sync your mobile notifications with your browswer so that you can see texts, phone calls, etc. Any notification you would normally get on your mobile device you will get in the PushBullet browser app. Yes, you can control which ones notify you via a muting feature.