Mel Reams


Git tip of the day

Today’s tip is a very simple git feature that I always seem to forget. Maybe by putting it on my blog I’ll finally remember it exists!

git reset --hard origin/<branch name>

What this does is force your local branch to really for really real match the state of the remote branch. If somebody reverts a bad commit on a remote branch and your local repo insists your copy is a commit ahead of the remote no matter how many times you try a simple git reset, then that command up there is what you need to fix things.

Quick guide to Chef + OpsWorks for Java devs who have other things to do

First, a caveat: I learned this on EC2 instances and make no promises that it will work in any other setup. That said:

  • The recipe runlist is not anywhere in your custom cookbooks, it’s in the layer settings for each layer in your stack.
  • If you add a new cookbook, recipes absolutely have to go in the recipes folder under the [cookbookname] folder.
  • Data that your recipe expects, such as “node[‘datadog’][‘jmx’][‘instances’]” must exist in an attributes file or your stack settings or something, but doesn’t necessarily have to have a value. The structure just needs to exist with the expected names.
  • Cookbooks have metadata ( where you define the version number of your cookbook and which other cookbooks it depends on. You can optionally list the recipes inside the cookbook but you don’t have to.
  • If you update your cookbook you can update that cookbook on your instances without redeploying them by running the Update Custom Cookbooks command from your stack (the run command button is beside the stack settings button on the “Stack” page for your stack).
  • Once you’ve updated your cookbook you can run your updated recipes almost the same way, just select “Execute Recipes” instead of “Update Custom Cookbooks” in the dropdown and put a list of recipes to execute in the field below the dropdown.


Linux tip of the day

If you want to see when you ran a particular command on a linux, you just need to run


at the command prompt, then the next time you run


you'll have handy timestamps! Thanks as usual to stackoverflow for that answer.

So that's cool and all, but why should you care? Because being systematic is extremely important when you're trying to solve a problem. If you don't know exactly when you changed something, you'll have a rough time figuring out which results were caused by which change. If you don't know which change caused which results, you're effectively stumbling around in a dark room at random, hoping you run into a light switch. Not only is that frustrating, but it's a huge waste of time. Systematically changing one thing, checking on the results, then changing one more thing and checking the results again can seem slow, but in the long run it's much faster than stumbling around and hoping.

Using myself as an example, knowing exactly when I ran a particular command let me compare what I had done with what was showing up in the logs and showed me that it was most likely a combination of two commands I had run rather than a weird delay after the first command that gave me the results I wanted. If I hadn't been able to figure out exactly when I ran each command I would still have no idea which one of them helped.

Tip of the day

Haven’t finished your Christmas shopping yet? Haven’t started? A really convenient last minute gift is giving to charity in your gift-getter’s name. CharityWatch has a great list of trustworthy charities and GiveWell will give your donations directly to the charities that they’ve found to be the most effective.

Or you could just go to the liquor store if you’re not worried about looking classy ;)

Talk of the day

I really enjoyed this recording of the Pycon 2015 keynote and I think you will too. My favourite part was the bit about we are all statistically unlikely to be terrible – it’s called a normal distribution for a reason, most of us are, drumroll please…. normal! Sure, you’re not super likely to be extraordinary (if everyone was then it really wouldn’t be extraordinary), but you’re not super likely to be terrible either. I personally find that comforting to remind myself of when I’m struggling with something and feel totally useless.

Dev tool of the day

Hey java devs, somebody built a REPL! It even runs in the browser, nothing to install or configure (or curse at). I love this thing for when I can’t remember which function accepts a null parameter and which one freaks out and throws a null pointer exception, it’s so helpful.

There is a REPL in Java 9, but we haven’t even switched to 8 yet at work (always let someone else try the new stuff first :) ). If you’re not exactly on the cutting edge either, try the online REPL, it’s awesome.

Talk of the day

If you share my obsession with software design (and maybe even if you don’t) you’ll enjoy this talk by Katrina Owen called Overkill. The basic idea of the talk is the use of a simple toy problem as an excuse for focused practice. I really like the idea of going back to basics as a path to mastery, that’s actually why I’ve been on my own back to basics kick on this blog.

If you like that talk, Katrina Owen co-authored an object oriented design book with Sandi Metz (who is also fantastic) called 99 Bottles of OOP. I haven’t read all of it myself yet, but I have watched (well, listened to) a few of Katrina’s and Sandi’s talks and really enjoyed them.

Chrome extension of the day

You know what sucks? Desperately trying to figure out how you broke your html layout, only to discover hours later that you had an invisible element or padding or a margin that was quietly ruining everything. Pesticide to the rescue! Pesticide is a very simple Chrome extension that does just one thing – it outlines all of your elements. That’s it.

I have a thing for simple tools that do one thing and do it well, and Pesticide is just that. No screwing around with settings, no trying to remember how to activate it, you just click the little bug icon beside your omnibox to turn it on and click it again to turn it off. Simple is just what you need when you’re fighting with your layout. Try it, you just might like it!

WordPress Appliance - Powered by TurnKey Linux