Nick Shemonsky

Ops, Infrastructure as Code, Miscellanea…

Fixing a Previous Git Commit

Have you ever been hammering out some code, making commits, only to realize you’ve botched something up a few commits ago? Happens to me quite often and I just realized there is an easy way to fix it via an interactive rebase.

As long as you haven’t pushed your commits upstream, follow these steps and you’ll be golden. If you have pushed, just make your fix in a new commit because the steps below will result in a new sha being generated for the commit you’re modifying.

  1. Save or stash your existing work.
  2. Use git log to find the first few characters of the ID of the commit you’d like to edit.
  3. Begin the interactive rebase by running git rebase -i ID^.
  4. Find your commit in the list you’ve been presented and change the word ‘pick’ to ‘edit’. Save and quit the editor.
  5. Make the necessary changes to your files.
  6. Run git commit -a --amend.
  7. Proceed with the rebase by running git rebase --continue.
  8. Resolve any conflicts created by your new changes.
  9. Re-apply any stashed changes.

Not So Shiny New Octopress Blog!

After much neglect, I am resurrecting my blog. It’s been long overdue and after reading some inspirational posts elsewhere on the Internets, specifically On Blogging by beerops, I’ve decided it was time.

In this reincarnation, I’ve switched from Wordpress to Octopress, mostly to simplify the posting process. With that decision came moving away from my previous hosting provider as well. Both my main landing page of and are now hosted on github-pages.

As originally intended, this blog will serve a few purposes.

  1. As a technical reference. Googling always works but sometimes I just need a place to take a quick note. Hopefully, these help someone else out down the line.
  2. As a public roadmap for mostly professional goings-on.
  3. As a place to comment on beers I’ve sampled. At this point, I’m well over 500 and would like to start documenting my thoughts on what I’ve tasted. If you’re on Untappd, add me as a friend!
  4. As a place to rant, rave and offer commentary on whatever happens to be on my mind.

With the interest of #1 in mind from the list from above, I wanted to share the few quick mods I made to the Octopress configuration.

Removing the rss subscription icon

First, modify _config.yml removing /atom.xml from the the subscribe_rss line.

# RSS / Email (optional) subscription links (change if using something like Feedburner)
# RSS feeds can list your email address if you like

Then modify source/_includes/navigation.html to conditionally include/exclude the rss icon.

{% if site.subscribe_rss %}
  <ul class="subscribe" data-subscription="rss{% if site.subscribe_email %} email{% endif %}">
{% endif %}

Modifying the date format for posts

The date format for posts can be adjusted via source/_includes/post/date.html. I prefer to not have the time listed for posts.


{% if %}{% capture time %}{{ page.date_time_html }}{% endcapture %}{% endif %}
{% if %}{% capture time %}{{ post.date_time_html }}{% endcapture %}{% endif %}

{% if page.updated %}{% capture updated %}{{ page.date_time_updated_html }}{% endcapture %}{% endif %}
{% if post.updated %}{% capture updated %}{{ post.date_time_updated_html }}{% endcapture %}{% endif %}


{% if %}{% capture time %}{{ page.date_html }}{% endcapture %}{% endif %}
{% if %}{% capture time %}{{ post.date_html }}{% endcapture %}{% endif %}

{% if page.updated %}{% capture updated %}{{ page.date_updated_html }}{% endcapture %}{% endif %}
{% if post.updated %}{% capture updated %}{{ post.date_updated_html }}{% endcapture %}{% endif %}

For additional date formatting options see:

Removing the simple_search bar

The simple_search is controlled by the {% if site.simple_search %}{% endif %} conditional in source/_includes/navigation.html.

Removing the url from the simple_search field in _config.yml will remove the search bar.

Removing the default /blog directory

Octopress deploys archives and categories to /blog by default. It can be removed using these steps:

  • Replace all occurences of /blog with / in _config.yml
  • Move source/blog/archives to source/
  • Delete /blog
  • Edit source/_includes/custom/navigation.html, replacing /blog/archives with /archives
  • Edit source/index.html, replacing /blog/archives with /archives

Python Switch/case Statements

Really, this post is about the complete lack thereof. While working on a script I needed to evaluate one of several potential arguments being passed in from the command line. Not wanting to write an if/elif/else nested 20 levels deep I went about doing what seems to be a fairly standard workaround for implementing a switch statement in Python; I created a dictionary mapping to a function for each potential option.

Busy, Busy…

So after starting this blog at the beginning of the year it fell to the back burner in the last several months as lots of things have changed in my life.

I started a new position just over a month ago where I will now get to focus on supporting cloud technologies, infrastructure as code and evangelizing devops methodologies. Exciting stuff and so far I’m loving it.

I also finally got around to finishing my MCSA on Windows Server 2008. Glad I got it done when I did because as I get up to speed in the new role, I certainly wouldn’t have had time to do it.

Now that I’m getting back in the groove, I intend to start posting somewhat regularly and hope to put some stuff up regarding working with Chef shortly.

Installing a LAMP Server on RHEL

Recently, I signed up for the free tier of Amazon Web Services. I wanted to gain some exposure to AWS and who can argue against having a free lab environment to play with?

One of the first things I wanted to do was set up was a web server. I thought I’d document the steps here for future reference.

Count Running PHP Processes With PowerShell

We have a server that seems to end up going haywire every Friday afternoon, spawning countless PHP processes. Last week it spiked at over 500 but we didn’t know when it began or ended specifically.

Powershell Remoting / Exchange 2010

I was tasked with updating our user creation / tear down tool to set an out of office message for users when their account is disabled following their termination.

Initially, I thought this would be as simple as adding a function to run Set-MailboxConfigurationAutoReply but every time the app tried to set a new out of office message I received the error: ‘Operation is not valid due to the current state of the object.’