Skip to content

Instantly share code, notes, and snippets.

@matejuh
matejuh / Makefile
Created January 18, 2012 20:31
Embedding a Ruby Interpreter
LIB=/home/matej/.rvm/rubies/ruby-1.9.2-p290/lib
INC=/home/matej/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
CFLAGS=-I$(INC) -I/home/matej/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/i686-linux/ -g
LDFLAGS=-L$(LIB) -ldl -lruby1.9
embed2: embed2.o
$(CC) -o embed2 embed2.o $(LDFLAGS)
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
@sunlightlabs
sunlightlabs / levenshtein.rb
Created August 19, 2009 18:07
Ruby C implementation of Levenshtein
# C implementation of Levenshtein text distance algorithm, uses RubyInline to call from within Ruby
# Wildly faster than the Text gem's Text::Levenshtein
# Example:
# l = Levenshtein.new
# l.distance 'hello', ' hello'
# => 1
# Taken from http://www.benallfree.com/2008/10/05/finding-duplicate-text-with-ruby/