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.
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:
Can you figure out what it’s doing? :)
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:
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”
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
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>
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
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):
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
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:
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
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.
Note: This would’ve been apparent if I had just cat the script… but man, am I lazy. :D