no cruft

Sep 28

On goals and execution…

Last year, I set a personal goal to commit something (anything) meaningful every day for an entire year.

Yesterday, I completed that goal.

Special thanks to this special someone who supported and reminded me if I had “checked in” for the day. <3

So here’s to setting far-reaching goals and still being able to execute on them.

Feb 27

Command-line Fu

As developers, we’re constantly tinkering and refactoring code to arrive at the tidiest and most maintainable piece of software. I’m still often surprised by how few of us optimize our working environments via shortcuts, aliases, and habits - especially considering the large time investment we often commit as software engineers.

Inspired by @hmason's Command-line Fu session at OrdCamp, I realized that there’s a lot of snippets I’ve written and accumulated over the years that could be useful to a young developer.

So without further adieu, I’ll try to post some of my more useful snippets at least once or twice a month beginning with one of my personal favs: tmux

https://gist.github.com/ryankanno/9244195

Can you figure out what it’s doing? :)

Oct 02

I’m back, for a μs

One of these days, I’ll get this blogging thing down, but until then, you’ll just have to bear with my yearly updates me.

The other day, someone suggested I write a quarterly entry about all the technologies I’ve been playing with. Not only should it spawn current discussion, but in retrospect, should provide some insight into what I was doing at certain points in my career.

So without further adieu, in no particular order, here’s what I’ve been looking at over the past few months:

Oct 22

Creating a LocalTunnel on dotCloud

tl;dr

If you want to install LocalTunnel on dotCloud, use this repo: https://github.com/cyounkins/tunnel-on-dotcloud

If you participate in a lot of hackathons or just want to expose a certain port on a development box to theInterwebs™, there’s a really useful app that performs all the ssh magic from one of the Twilio engineers, http://progrium.com/localtunnel/ . Installing this rubygem magically assigns an unused proxied subdomain from localtunnel.com so you can show off your wares.

While extremely useful in the one-off hackathon world, it’s a bit problematic if your app connects to a number of external services. Each time you’re assigned a different proxied subdomain from localtunnel, you’ll have to log into aforementioned services and change the callback urls or update a mystical dns redirect entry - both undesirable behaviors… especially having done this several umpteen times. :)

Having stumbled upon this dotCloud blog entry, http://blog.dotcloud.com/open-your-local-webapp-to-the-web-with-dotclo and walked the tutorial, the repo referenced didn’t actually have a working nginx.conf file to do the proxying - looks to be commented out and missing a few other directives. In any case, thank you Interwebs, here’s a working repo: https://github.com/cyounkins/tunnel-on-dotcloud

As a note, make sure you kill any open ssh sessions in dotCloud. If you’re careless like me with a lot of tmux sessions open, you’ll often get “Warning: remote port forwarding failed for listen port 8042” which generally translates to “Close your other open ssh sessions”

May 20

Ignoring changes in git submodules

For those Vimmers using Pathogen to manage your runtime path, you’ll find that Pathogen creates tags files in the bundle’s doc folder.

Thanks to this Stack Overflow post, all you need is Git 1.7.2 and the following command:

 for s in `git submodule  --quiet foreach 'echo $name'`; 
      do git config submodule.$s.ignore untracked; 
 done

Happy Vimming!

May 06

Avoiding the ESC key in Vim (and Readline)

It’s probably safe to say that I should’ve changed this (ugh) habit years ago, but I just never got around to it. Thanks to Stephen, I’ve finally updated my .vimrc to exit insert mode using:

inoremap jk <ESC>

Yay!

More importantly, if you tend to set vi editing mode in readline, you definitely want to change its bindings as well. I found this gem hidden deep in the Vim Tips Wiki.

All you have to do is edit your .inputrc file with the following: set editing-mode vi set keymap vi

$if mode=vi
    set keymap vi-command
    "ii": vi-insertion-mode
    set keymap vi-insert
    "jk": vi-movement-mode
$endif

As a note: Readline will pick these settings up for every readline enabled app (IPython, etc)

Happy Vimming! :D

Apr 17

Where did all my disk space go?

— Update

Thanks to @pgr0ss for the tip, you can use -k instead of —block-size!

On my cloud servers, I’m always asking myself:

Where the !@#$% did all my disk space go?

And I know somewhere, sometime down the road, future self will be thanking present self for blogging this as a reminder.

To get the top <n> offending directories on your filesystem (replace <n> with a number):

via http://linuxreviews.org/quicktips/chkdirsizes/

Feb 09

Access to OS X pasteboard in tmux/screen

If you’re having trouble accessing pbcopy/pbpaste from tmux and/or an unpatched screen, check out https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard.git

tl;dr

  1. Clone repo
  2. Run makefile
  3. Add to path (or add symlink on path)
  4. Add set-option -g default-command “reattach-to-user-namespace -l zsh” or whatever your favorite shell is in your .tmux.conf

code!

Feb 06

Getting uWSGI + init.d playing nicely on Ubuntu 11.10

A few weeks ago, I wanted to install uWSGI on my Ubuntu 11.10 box for http://allb.us.  After having gone through the standard aptitude/pip installs to get uwsgi installed, I noticed after running the init.d scripts, absolutely nothing would happen. 

zip. nada. zilch.

No log file + no uwsgi process == a lot of sad pandas.

After having searched stackoverflow, it was quite apparent that I wasn’t the only unlucky soul to encounter this error.  To debug the uwsgi init.d script, I used the trusty set -xv trick atop to see the omgwtfbbqs.

Here’s a few things I realized:

  1. The configuration file in /etc/uwsgi/apps-enabled must contain one of the recognized uwsgi configuration file extensions.  Initially, I symlinked my configuration file from the apps-available directory as allbus.  It didn’t like that at all.  I renamed the symlink to allbus.xml.
  2. The start-stop-daemon in the init.d script is being passed the location to the pid file via —pid-file instead of being told to create the pid file via the —make-pid-file option.  Thus, you need to make sure your uwsgi configuration file contains a directive to create the file at the same location the init.d script is looking for it.  *Note*: Take a look at the <pidfile> configuration.

Here’s a gist I created of the xml uwsgi configuration I used for my Django application. Hopefully it helps save someone from the hour I spent in startup script hell. Enjoy! :D

Jan 30

Passing in a custom port to ssh-copy-id

Thank you, #lazyweb.

After years of using ssh-copy-id to drop public keys into a remote machine’s authorized keys, I finally found a post showing how to use the script to connect to a remote machine running on a custom port.

http://it-ride.blogspot.com/2009/11/use-ssh-copy-id-on-different-port.html

Note: This would’ve been apparent if I had just cat the script… but man, am I lazy. :D