Skip to content

Instantly share code, notes, and snippets.

@apeckham
apeckham / sphinx-beta.rb
Created September 13, 2011 00:58 — forked from mikezter/sphinx-beta.rb
Homebrew Recipe to install Sphinx Search 1.10-beta
require 'formula'
class SphinxBeta < Formula
url 'http://sphinxsearch.com/files/sphinx-1.10-beta.tar.gz'
homepage 'http://www.sphinxsearch.com'
md5 '5b52ce9e93a73c66d37bc3a2402f14fa'
head 'http://sphinxsearch.googlecode.com/svn/trunk/'
def install
fails_with_llvm "fails with: ld: rel32 out of range in _GetPrivateProfileString from /usr/lib/libodbc.a(SQLGetPrivateProfileString.o)"
require 'uri'
uri = URI.parse(ARGV[0])
exec "psql 'user=#{uri.user} password=#{uri.password} host=#{uri.host} dbname=#{uri.path[1..-1]}'"
function onInsideBracket(string) {
return '<span class="lookup">' + Ext.htmlEncode(string) + '</span>';
}
function onOutsideBracket(string) {
return Ext.htmlEncode(string);
}
function formatBrackets(string) {
var out = "";
@apeckham
apeckham / .gitignore
Created January 12, 2012 15:58
CSV export with Sequel and FasterCSV
*.sql
*.sh
*.swp
@apeckham
apeckham / gist:1602291
Created January 12, 2012 18:40
postgres 9 on amazon linux
sudo rpm -ivh http://yum.pgrpms.org/9.0/redhat/rhel-5-i386/pgdg-redhat90-9.0-5.noarch.rpm
sudo yum install postgresql90 -y
@apeckham
apeckham / gist:1635181
Created January 18, 2012 19:58
solution to level 2 on peanutty.org
Peanutty.loadLevel()
peanutty.createBall
x: 203.94690265486724
y: 509.8672566371681
radius: 20
static: true
peanutty.wait(440)
peanutty.createBall
@apeckham
apeckham / .gitignore
Created January 18, 2012 20:28
node duplicating proxy
node_modules
:syslogtag, isequal, "heroku[nginx]" /var/log/heroku.log
:inputname, isequal, "imtcp" ~
####################################
# 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 -y upgrade
CREATE OR REPLACE FUNCTION ci_lower_bound(integer, integer) RETURNS numeric LANGUAGE plpgsql IMMUTABLE
AS $$
DECLARE
up_votes ALIAS FOR $1;
total_votes ALIAS FOR $2;
z numeric;
p_hat numeric;
BEGIN
IF total_votes <= 0 OR up_votes < 0 OR up_votes > total_votes THEN
RETURN 0;