Skip to content

Instantly share code, notes, and snippets.

View leehambley's full-sized avatar

Lee Hambley leehambley

View GitHub Profile
app = angular.module('app', ['ngResource'])
app.factory("Result", ["$resource", ($resource) ->
$resource("/scrapes/:scrape_id/results/:id", {scrape_id: "@scrape_id", id: "@id"})
])
app.controller("MainCtrl", ['$scope','Result',($scope,Result)->
$scope.scrape = {id: 1}
$scope.results = []
$scope.getResults = (->
# General settings
unbind C-b
set -g prefix C-a
set -g default-terminal "screen-256color"
set -sg escape-time 1
setw -g automatic-rename off
# Base index 1
set -g base-index 1
set-window-option -g pane-base-index 1
apt-get install -y build-essential
apt-get build-dep -y postgresql
wget http://ftp.postgresql.org/pub/source/v9.2.1/postgresql-9.2.1.tar.gz
tar -zxvf postgresql-9.2.1.tar.gz
cd postgresql-9.2.1
export MAJOR_VER=9.2
./configure \
--prefix=/opt/chef/embedded \
--mandir=/opt/chef/embedded/share/postgresql/${MAJOR_VER}/man \
--docdir=/opt/chef/embedded/share/doc/postgresql-doc-${MAJOR_VER} \

Open the postgresql.conf config file:

$> mate /usr/local/var/postgres/postgresql.conf

Uncomment the line with 'log_destination' and set it to 'syslog'

log_destination = 'syslog'

Open the syslog config:

# From a fresh install of squeeze
apt-get install ruby rubygems # Need ruby to use fpm
gem1.8 install fpm --no-ri --no-rdoc
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -zxvf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125
rm -rf /tmp/ruby193
/**
* Based conceptually on the _.extend() function in underscore.js ( see http://documentcloud.github.com/underscore/#extend for more details )
* Copyright (C) 2012 Kurt Milam - http://xioup.com | Source: https://gist.github.com/1868955
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
**/
@leehambley
leehambley / mymysql-connection-pool.go
Created December 21, 2012 17:29 — forked from rday/gist:3504674
Mymysql Connection Pooling for Golang.
type InitFunction func() (interface{}, error)
type ConnectionPoolWrapper struct {
size int
conn chan interface{}
}
/**
Call the init function size times. If the init function fails during any call, then
the creation of the pool is considered a failure.
@leehambley
leehambley / gist:3196458
Created July 29, 2012 06:52 — forked from danparsons/gist:3195652
How to stream the London 2012 Olympics

How to stream the London 2012 Olympics

There have been several HOWTOs posted regarding streaming the 2012 Olympics using HTTP / SOCKS proxies via SSH and other similar methods. None of these actually work using the latest Flash on Mountain Lion (with Firefox, Chrome or Safari). Additionally, the third-party streaming sites don't provide BBC's amazing interface, which lets you quickly skip to individual competitors and events. However, setting up an OpenVPN server does work, with some tweaks. You'll get the exact same UX that people in England receive.

@leehambley
leehambley / install-ruby-debug-ruby-1.9.3.sh
Created January 11, 2012 09:24 — forked from rmoriz/install-ruby-debug-ruby-1.9.3.sh
ruby-debug in ruby-1.9.3 and rbenv
#!/bin/bash
cd /tmp
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
wget http://rubyforge.org/frs/download.php/74596/ruby_core_source-0.1.5.gem
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
wget http://rubyforge.org/frs/download.php/63094/ruby-debug19-0.11.6.gem
export RBENV_INCLUDE=$HOME/.rbenv/versions/1.9.3-p0/include/ruby-1.9.1/ruby-1.9.3-p0
gem install archive-tar-minitar
@leehambley
leehambley / query_builder_helper.rb
Created September 26, 2011 12:35 — forked from paukul/query_builder_helper.rb
solr query sanitizer using a statemachine (like a baws!)
# the only dependencies are http://rubygems.org/gems/transitions
# and I think active support
module Search
module QueryBuilderHelper
def sanitize_field_for_solr_query(query)
if query.is_a?(Hash)
query.inject({}) do |result, query_component|
result[query_component.first] = query_component.first == '*' ? query_component.last : QueryField.sanitize(query_component.last)
result