Skip to content

Instantly share code, notes, and snippets.

@theirishpenguin
theirishpenguin / sort_dir
Created January 17, 2012 11:45
Sort the contents of each file in the current directory (non-recursive)
# Usage:
#
# (Note - This command does not recursively traverse subdirectories!)
#
# * Save the script to a directory that is in your PATH variable so it can be executed
# * chmod u+x path/to/sort_dir # so that it can be executed
# * cd into the directory containing the files who's contents you wish to sort
# * Simpy run the command 'sort_dir'
# * This will product an subdirectory called 'sorted' containing all the current
# directory's files with their contents sorted
aptitude install vim-gnome
The following NEW packages will be installed:
libruby1.8{a} vim-gnome
@theirishpenguin
theirishpenguin / rsub
Created January 30, 2012 17:46
Recursively replace files in the current directory and subdirectories using regular expressions
# Usage
# (Note: This command does not handle spaces in filenames!)
# * cd into the directory containing the files and subdirectories of files in
# which you wish to carry out string substitution using a regex
# * Run the command:
# rsub 'search regex' 'replacement text'
# * This will effect the desired substitution in files in the current directory
# and in any subdirectories
# Explaination
@theirishpenguin
theirishpenguin / .vimrc.before
Created January 31, 2012 10:23
Janus .vimrc configuration to set indentation to 4 spaces instead of 2
# Note: Best Janus practice is to drop these into ~/.vimrc.before rather than ~/.vimrc itself
set tabstop=4
set shiftwidth=4
set softtabstop=4
autocmd User Rails/**/* set tabstop=4
autocmd User Rails/**/* set shiftwidth=4
autocmd User Rails/**/* set softtabstop=4
# P.S. Thanks to http://www.savagevines.com/post/2011/8/14/overriding_indentation_settings_for_vimrails for shining light on this area
@theirishpenguin
theirishpenguin / SpreeConf 2012
Created August 3, 2012 13:39
The super conf for developers this August in Dublin
It's been a while since the last blog post (almost becoming an annual publication) and I'm in the process of moving theirishpenguin.com - hence this gist - but I felt inspired to write about an amazing event coming up this month, now that we've hit August. It's SpreeConf Europe, it's happening in Dublin and it has a star-studded lineup from round the world!
It kicks of on the 22nd of August in the Guinness Storehouse (http://www.guinness-storehouse.com) and lasts for two fabulous days of tech talk that cover a range of topics, that will appeal to a general developer audience. Talks featuring Javascript, Backbone, Rails as well as e-commerce will be to the fore. As will, of course, Spree Commerce itself which, over the last year and a half, has grown to be one of the most prominent Open Source projects on Github. Now, onto some of the headline acts...
Yehuda Katz - Ruby on Rails and jQuery core team member delivers the keynote
Gregg Pollack - of Ruby5 podcast and Code School fame
Ryan Bigg - Author of 'Rail
@theirishpenguin
theirishpenguin / irssi-libnotify-plugin-ubuntu-installer.sh
Created October 11, 2012 13:46
irssi libnotify installer for ubuntu
#!/bin/bash
# This is a wrapped up version of the instructions at
# http://code.google.com/p/irssi-libnotify/wiki/MainPage for ubuntu
#
# Usage: Just run this script from the command line with no arguments
#
# Tested on Ubuntu 12.04.1 (64 bit)
echo ""
@theirishpenguin
theirishpenguin / prettify_json.rb
Created October 12, 2012 16:58
Simple ruby script to take a json file and output it in a nicely indented format
#! /usr/bin/env ruby
require 'json'
unless ARGV.length == 1
puts "
Usage: prettify_json.rb path/to/file.json
It's simple! It is strongly recommended that you redirect any errors to an
error.txt file (to make them easy to read) as follows...
@theirishpenguin
theirishpenguin / gist:4039750
Created November 8, 2012 16:07
Global Code Retreat
A short summary of the day; starts early, around 8.30, there are 6 or
7 iterations of 45 minutes each, trying to solve Conway's Game of Life
(http://en.wikipedia.org/wiki/Conway's_Game_of_Life). All iterations
are in pairs (one computer), and the language is chosen by the pair.
At the end of the 45 minutes you have to DELETE all your code, stand
up for a 5 minutes group retrospective (in which we ask uncomfortable
questions if no one speaks up), and then a 10 minute break to grab
some coffee and find a new partner for the next iteration. Each
iteration will have some additional rules (things like, no if
statements allowed, or applying 'tell don't ask', depending on the
@theirishpenguin
theirishpenguin / ssd-dd-benchmark
Created November 11, 2012 11:10
Simple benchmark for your SSD. Takes into account alignment of your disks
#!/bin/bash
# Based on the dd test script at https://wiki.archlinux.org/index.php/SSD_Benchmarking
# Disclaimer: Use at your own risk. This program comes with no warranty.
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2 # in order for the drop_caches command to work
exit 1
fi
@theirishpenguin
theirishpenguin / wide-github-diffs.js
Last active December 20, 2015 05:39
Wide Github Diffs
$('div.site div.container')[1].style.width='95%';var div=$('div#js-repo-pjax-container')[0];div.style.width='95%';