Skip to content

Instantly share code, notes, and snippets.

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
@lucaspiller
lucaspiller / never_gonna.ws
Created June 1, 2012 14:04
Never Gonna Give You Up (Whitespace)
@lucaspiller
lucaspiller / gist:3104392
Created July 13, 2012 11:23
Support writing a header and footer with the Spreadsheet gem
module Spreadsheet
module Excel
module Writer
class Worksheet
alias_method :write_from_scratch_without_header_footer, :write_from_scratch
def write_from_scratch
if @worksheet.header
write_op opcode(:header), [@worksheet.header.bytesize, 0].pack("vC"), @worksheet.header
end
THREE.Mesh.prototype.rotateAboutObjectAxis = (axis, radians) ->
rotationMatrix = new THREE.Matrix4()
rotationMatrix.makeRotationAxis axis.normalize(), radians
@matrix.multiplySelf rotationMatrix
@rotation.getRotationFromMatrix @matrix
THREE.Mesh.prototype.rotateAboutWorldAxis = (axis, radians) ->
rotationMatrix = new THREE.Matrix4()
rotationMatrix.makeRotationAxis axis.normalize(), radians
rotationMatrix.multiplySelf @matrix
THREE.Mesh.prototype.rotateAboutObjectAxis = (axis, radians) ->
rotationMatrix = new THREE.Matrix4()
rotationMatrix.makeRotationAxis axis.normalize(), radians
@matrix.multiplySelf rotationMatrix
@rotation.getRotationFromMatrix @matrix
THREE.Mesh.prototype.rotateAboutWorldAxis = (axis, radians) ->
rotationMatrix = new THREE.Matrix4()
rotationMatrix.makeRotationAxis axis.normalize(), radians
rotationMatrix.multiplySelf @matrix
@lucaspiller
lucaspiller / test_log_formatter.rb
Created August 15, 2012 10:02
Test Log Formatter
require 'rspec/core/formatters/progress_formatter'
#
# Test Log Formatter
#
# * Logs example descriptions to the Rails test.log
# * If the PRINT_FAILURE_LOG env is set, the test.log for failed examples will
# be printed to stdout
#
# Put this somewhere, e.g. spec/support/test_log_formatter.rb, then add this to your .rspec:
@lucaspiller
lucaspiller / gist:3377737
Created August 17, 2012 10:16
Tmux Primer

I use this function to setup / resume my tmux sessions. If a session exists with the given name it resumes it, otherwise it creates it:

tm() {
  [[ -z "$1" ]] && { echo "usage: tm <session>" >&2; return 1; }
  tmux has -t $1 && tmux attach -d -t $1 || tmux new -s $1
}

(N.b. If you use something similar already check you have the -d flag. This will kill old clients (e.g. ssh connections that died, quitting your terminal before disconnecting) and ensure the window resizes correctly.)

@lucaspiller
lucaspiller / index.html
Created September 20, 2012 23:00
Isometric CSS Test
<!-- See example at http://bl.ocks.org/3758852 -->
<html>
<head>
<title>Isometric Test</title>
<style>
.board {
-webkit-transform:matrix(1,-0.6, 1,0.6, 0,0);
-moz-transform:matrix(1,-0.6, 1,0.6, 0,0);
-o-transform:matrix(1,-0.6, 1,0.6, 0,0);
transform:matrix(1,-0.6, 1,0.6, 0,0);