Sortiq - sort, uniq, sort

This is a small snippet I find extremely useful. You should have it in your ~/.bashrc:

sortiq() { sort | uniq -c | sort -rn ; }

It will count the instances of each line, sorting them from most common to least common.

What is this for

It answers the question "How much of each …

more ...

Filtering in Shell

Today I told someone that a feature I'm missing in Bash is filtering.
Then I thought about how much I miss it, so I went ahead and "implemented" it.

Filtering in other lanaugaes

Basically, I'm referring to taking a collection/stream of items, running some code on every one, and …

more ...

Cookbook Versioning Script

The Problem

I've always disliked releasing cookbook versions manually. The process requires a lot of bureaucratic steps which are easy to forget and require no thought at all.
Before I had this script, I sometimes avoided modifying the cookbook's version when I only applied "a little fix", losing the ability …

more ...


Batch fitting pictures in ImageMagick

I recently bought a digital frame for some of my more elderly relatives.
The frame's firmware was quite retarded, and I had 2 issues with it:

1. Pictures were always displayed in order

This might be a "not a bug but a feature" type of situation, but still.
I solved …

more ...

Getting Git Submodule Detailed Status

The Story

I manage every one of my Chef cookbooks as a single git repository, complying with the BerkShelf paradigm. I keep them all as submodules in a "supermodule", to allow my teammates to easily clone them all. I can use git status from the supermodule to get submodule information …

more ...

Git Prompt Variables

I recently reinstalled my laptop and had to reconfigure my git prompt. I use the git prompt script that is included in Ubuntu's git package, and integrate it into my prompt by editing ~/.bashrc, executing source /etc/bash_completion.d/git-prompt, and adding $(__git_ps1) to my PS1 variable, just before the …

more ...

Timing Execution By Output Lines

The Story

Today I got annoyed that some puppet agent runs took me over 90 seconds to complete, even though they actually did nothing (no change was needed).
I wanted to see which part of the run took the longest, so I tried this:

sudo puppet agent --test --debug

Unfortunately …

more ...

Hijacking a process's i/o streams using gdb

The Story

I recently had a very annoying problem - some daemon failed, but ran fine when told to run at foreground (not daemonize). Running at foreground is the easiest way to debug processes, because that way you get their input / output / error streams in your terminal.
Said daemon had no …

more ...

Listing Unity's Scopes and Originating Package

I recently upgraded to Ubuntu 14.04 (beta2), and I got all of my "lenses" (searching additional items in the dash menu), that look like this:

Of course there's a way to disable those lenses, but I actually want to remove those I'll never use (like flickr).
The problem  - lenses …

more ...