Skip to content

Instantly share code, notes, and snippets.

@timgentry
timgentry / lion_dev_setup
Created September 15, 2011 10:20
Developer setup of a vanilla Lion install
#!/bin/bash
# Run using: bash <(curl -s https://raw.github.com/gist/1218967)
#
# Oracle setup based on Lion fix by jcotter
# https://forums.oracle.com/forums/message.jspa?messageID=9777450#9777450
if ! which gcc >/dev/null ; then
echo
echo "Error: XCode not installed; aborting."
exit
@timgentry
timgentry / gist:1330408
Created November 1, 2011 12:19
Install additional Textmate bundles
#!/bin/bash
# Fullscreen (Lion)
bash <(curl -s -L http://gr3g.me/tm-full)
# Missing Drawer
bash <(curl -s -L http://goo.gl/4RUoP)
mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
@timgentry
timgentry / gist:20b2b8add3c711e415e3
Last active August 29, 2015 14:06
Coloured prompt with ruby version and git branch name
# Git branch based prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1 /'
}
# ruby version based prompt
function parse_ruby_version {
eval "rbenv version-name"
}
@timgentry
timgentry / .block
Last active January 12, 2017 11:18 — forked from mbostock/.block
Radial Reingold–Tilford Tree
license: gpl-3.0
@timgentry
timgentry / .block
Last active June 14, 2016 22:46
Radius vs. Area
license: mit
@timgentry
timgentry / .block
Last active January 27, 2024 22:43
Radial Reingold–Tilford Tree (d3 v4)
license: gpl-3.0
border: no
height: 1060
@timgentry
timgentry / svn_timestamp.rb
Created February 27, 2017 14:27
Parse subversion last-changed-date timestamp
require 'time'
def last_changed_date
return @last_changed_date if @last_changed_date
timestamp = `svn info --show-item last-changed-date --no-newline`
# timestamp = "2017-02-27T13:18:11.822530Z"
@last_changed_date = DateTime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%L').to_time
end
puts last_changed_date.inspect
# Append to /etc/rc.local
if [ -f /boot/xinitrc ]; then
ln -fs /boot/xinitrc /home/pi/.xinitrc;
su - pi -c 'startx' &
fi
@timgentry
timgentry / marshal_vs_yaml.rb
Created March 10, 2017 09:36
Benchmarking test of Marshal vs YAML serialise/deserialise object cloning
require 'benchmark'
require 'yaml'
n = 10_000
original = YAML.load <<-YML
- column: surname
rawtext_name: surname
mappings:
- field: surname
clean: :name
@timgentry
timgentry / example_stat.sh
Created March 16, 2017 12:32
Random stat
while true; do echo -n "project.bob.example:$((RANDOM % 100))|c" | nc -w 1 -u 127.0.0.1 8125; done