Skip to content

Instantly share code, notes, and snippets.

@jasonroelofs
jasonroelofs / etc-init-ssh.conf
Created March 6, 2012 18:17
Compare Upstart's ssh handling to the SysV init script
# ssh - OpenBSD Secure Shell server
#
# The OpenSSH server provides secure shell access to the system.
description "OpenSSH server"
start on filesystem
stop on runlevel [!2345]
respawn
@jasonroelofs
jasonroelofs / control-alt-delete.conf
Created February 27, 2012 18:44
Ubuntu 10.04 LTS Upstart config handles CTRL-ALT-DELETE
# control-alt-delete - emergency keypress handling
#
# This task is run whenever the Control-Alt-Delete key combination is
# pressed, and performs a safe reboot of the machine.
description "emergency keypress handling"
author "Scott James Remnant <[email protected]>"
start on control-alt-delete
@jasonroelofs
jasonroelofs / clock.rb
Created January 24, 2012 20:57
Why write two lines of code when you can write 30!
class Clock
def self.now
Time.now
end
def self.today
Date.today
end
end
] irb
1.8.7 :001 > module TestModule
1.8.7 :002?> end
=> nil
1.8.7 :003 > module TestModule2
1.8.7 :004?> end
=> nil
1.8.7 :005 >
1.8.7 :006 > class TestClass
1.8.7 :007?> include TestModule
@jasonroelofs
jasonroelofs / database_copy.rb
Created September 21, 2011 15:38
Quick script to use the ar_dbcopy gem for moving data between databases.
##
# Script to copy over data from mysql to postgres
#
# gem install ar_dbcopy --ignore-dependencies
#
# db_copy.yml needs to look like:
#
# source:
# adapter: mysql
# host: localhost
@jasonroelofs
jasonroelofs / gist:952278
Created May 2, 2011 20:20
Installing MySQL GEM on Mac OS X
[sudo] env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=[path/to/mysql_config]
@jasonroelofs
jasonroelofs / setup-statsd.sh
Created April 27, 2011 18:25 — forked from collegeman/setup-statsd.sh
Turn an Ubuntu 10.10 EC2 into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use
require 'rbconfig'
config = RbConfig::CONFIG
FLAGS = %|-L#{config["libdir"]} -I#{config["includedir"]} -I#{config["includedir"]}/rubinius|
desc "Build the test with shared linkage"
task :build_shared do
cmd = "g++ #{FLAGS} #{config["LIBRUBYARG_SHARED"]} main.cpp -o main"
sh cmd
end
@jasonroelofs
jasonroelofs / gist:874688
Created March 17, 2011 16:57
Adding a Planet, with custom scale
Actor* planet = new Actor();
planet->transform->scale = Ogre::Vector3(size, size, size);
planet->addComponent(new components::MeshComponent("sphere.mesh", "dirt"));
@jasonroelofs
jasonroelofs / gist:874671
Created March 17, 2011 16:52
From Game.cpp, initializing the player's Camera Actor
Actor* actor = new Actor(utils::calculatePosition(Ogre::Vector3(4, 5, 4)));
actor->addComponent(new components::CameraComponent(mWindow));
actor->addComponent(new components::MovementComponent());
actor->addComponent(new components::MouseLookComponent());