Skip to content

Instantly share code, notes, and snippets.

@lucaspiller
lucaspiller / gist:847749
Created February 28, 2011 18:17
Riak basic benchmark script
#!/usr/bin/env ruby
require 'bundler'
Bundler.setup( :utilities )
Bundler.require( :utilities )
class Value
include Ripple::Document
property :name, String
@lucaspiller
lucaspiller / gist:847756
Created February 28, 2011 18:26
Riak config
$ cat /etc/riak/app.config
%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 et
[
%% Riak Core config
{riak_core, [
%% Default location of ringstate
{ring_state_dir, "/var/lib/riak/ring"},
%% http is a list of IP addresses and TCP ports that the Riak
gem list | grep '(' | awk ' { print $1, $2 } ' | sed 's/[\(\),]//g' | awk -F " " ' { print "gem \""$1"\",","\""$2"\"" } ' >> Gemfile
@lucaspiller
lucaspiller / isthereanewgit.rb
Created June 14, 2011 16:23
Checks whether the version of Git you have installed is the latest.
require 'open-uri'
require 'rubygems'
require 'nokogiri'
doc = Nokogiri::HTML(open('http://git-scm.com/'))
latest = if doc.css('#ver').first.content =~ /v([0-9.]+)/
$1
else
abort "Borked"
end
@lucaspiller
lucaspiller / gist:1101508
Created July 23, 2011 14:49
CoffeeScript Bug
class Model
CONST_A: 1
CONST_B: 2
CONSTS: [@CONST_A, @CONST_B]
m = new Model
# => Model
m.CONST_A
# => 1
@lucaspiller
lucaspiller / gist:1213285
Created September 13, 2011 06:55
t.co is slow... (from a London data centre)
$ ping -c 10 t.co
PING t.co (199.59.148.12) 56(84) bytes of data.
64 bytes from r-199-59-148-12.twttr.com (199.59.148.12): icmp_seq=1 ttl=47 time=152 ms
64 bytes from r-199-59-148-12.twttr.com (199.59.148.12): icmp_seq=2 ttl=47 time=151 ms
64 bytes from r-199-59-148-12.twttr.com (199.59.148.12): icmp_seq=3 ttl=47 time=152 ms
64 bytes from r-199-59-148-12.twttr.com (199.59.148.12): icmp_seq=4 ttl=47 time=151 ms
64 bytes from r-199-59-148-12.twttr.com (199.59.148.12): icmp_seq=5 ttl=47 time=152 ms
64 bytes from r-199-59-148-12.twttr.com (199.59.148.12): icmp_seq=6 ttl=47 time=152 ms
64 bytes from r-199-59-148-12.twttr.com (199.59.148.12): icmp_seq=7 ttl=47 time=152 ms
64 bytes from r-199-59-148-12.twttr.com (199.59.148.12): icmp_seq=8 ttl=47 time=152 ms
My.cnf:
$ cat /etc/my.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
@lucaspiller
lucaspiller / gist:1845692
Created February 16, 2012 15:38
How to annoy your friends on iMessage
tell application "iChat"
repeat with t in every service
repeat with b in every buddy of t
if name of b contains "Piotr" and handle of b contains "+44" then
repeat with v from 1 to 10
send "HAI" to b
end repeat
end if
end repeat
end repeat
@lucaspiller
lucaspiller / graphite.md
Created May 10, 2012 15:33 — forked from caged/graphite.md
Installing Graphite on OS X Lion

This is a general overview (from memory) of the steps I used to install graphite (http://graphite.wikidot.com) on OS X Lion. I think the steps are in order but YMMV. Please fork and fix if you find an error.

Install Python 2.7.3

brew install python

Check your env

$ python --version
sudo apt-get install mongodb ◼ version:2.1.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libabw-0.0-0 libatkmm-1.6-1 libboost-filesystem1.55.0 libboost-program-options1.55.0 libboost-regex1.55.0 libcairomm-1.0-1 libdrm-dev libe-book-0.0-0 libegl1-mesa-dev libetonyek-0.0-0 libfreehand-0.0-0 libgl1-mesa-dev libglibmm-2.4-1c2a libgtkmm-2.4-1c2a libmwaw-0.2-2 libpangomm-1.4-1 libwayland-dev libx11-xcb-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0 libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxshmfence-dev libxxf86vm-dev
mesa-common-dev x11proto-dri2-dev x11proto-gl-dev x11proto-xf86vidmode-dev
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
binutils binutils-dev cpp cpp-5 dbus g++ g++-5 gcc gcc-5 gcc-5-base libabw-0.1-1 libapparmor1 libasan2 libatomic1 libboost-date-time1.58.0 li