Skip to content

Instantly share code, notes, and snippets.

View mriddle's full-sized avatar

Matthew Riddle mriddle

View GitHub Profile
@mriddle
mriddle / chef_solo_bootstrap.sh
Created September 9, 2012 06:32 — forked from cmaitchison/chef_solo_bootstrap.sh
Ubuntu 12.04 Chef-Solo bootstrap (VPSBlocks)
#!/bin/bash -xe
#THIS SCRIPT MUST BE RUN AS ROOT
ADMIN_USER=admin
ADMIN_GROUP=admin
#add admin group
(cat /etc/group | grep -E '\b$ADMIN_GROUP\b') || sudo groupadd $ADMIN_GROUP
#add admin user
@mriddle
mriddle / postgres_table_sizes
Created June 7, 2012 07:17
Finding the total size of your biggest tables
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND C.relkind <> 'i'
AND nspname !~ '^pg_toast'
ORDER BY pg_total_relation_size(C.oid) DESC
LIMIT 20;
@mriddle
mriddle / coloured_git_output
Created May 11, 2012 23:18
Colour your git terminal output
git config --global color.ui true
@mriddle
mriddle / gist:1675779
Created January 25, 2012 10:41
Moving your work to other machines without pushing to master
# Commit your work locally and from the remote machine run
$ git pull dev@devmac-2:~/projects/atlas/atlas master
@mriddle
mriddle / git_reverting_multiple_commits.sh
Created January 25, 2012 02:49
[git foo] reverting multiple commits in one hit
# Below is the strat on reverting multiple commits while rolling forward rather than winding back
$ git reset --hard f7a4ffb0291f5fab47dd539a47e04bbd659e138
# Where the SHA is the known good version you want to be back at
$ git reset --soft @{1}
# Which brings you back to origin head with the changes off the past commits reversed
# eg
# [-console.log("Loosing")-]{+console.log("Winning")+}
# becomes
# [+console.log("Winning")+]{-console.log("Loosing")-}