Skip to content

Instantly share code, notes, and snippets.

// Standard jQuery plugin pattern
(function($){
$.fn.pluginName = function(options) {
var options = $.extend({},$.fn.pluginName.defaults,options)
return this.each(function() {
// Code goes here
// $(this) //DOM element
//
@crofty
crofty / See network traffic
Created February 12, 2010 09:09
see netork traffic
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"
chsh -s /bin/bash
@crofty
crofty / postgres setup ubuntu
Created December 2, 2009 21:34
Postgres setup
# Postgres install on ubuntu
sudo apt-get install postgresql
# Log in with
sudo -u postgres psql postgres
# change password by issuing
\password postgres
# create databases with
@crofty
crofty / projects_controller.rb
Created November 5, 2009 14:36
Standard Rails REST resource
class ProjectsController < ApplicationController
# GET /projects
# GET /projects.xml
def index
@projects = Project.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @projects }
end
@crofty
crofty / Integrity_ci_setup_on_slicehost.sh
Created November 3, 2009 17:37
Integrity CI setup on slicehost
# Integrity CI setup on slicehost
useradd -m ci
sudo passwd ci
su ci
bash
gem install bundler
git clone git://github.com/integrity/integrity
cd integrity
git checkout -b deploy v0.2.0
@crofty
crofty / jruby_setup_on_slicehost.sh
Created November 3, 2009 15:31
jruby setup on slicehost
sudo vi /etc/apt/sources.list
# Add multiverse to the end of each of the strings
sudo apt-get update
sudo apt-get install sun-java6-jdk
java -version
#java version "1.6.0_06"
#Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
#Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode)
@crofty
crofty / CouchDB setup on slicehost
Created September 9, 2009 15:22
CouchDB setup on Slicehost
sudo apt-get update
sudo aptitude install build-essential
sudo apt-get install libmozjs-dev libicu-dev libcurl4-openssl-dev erlang
mkdir ~/src
cd ~/src
wget http://apache.mirror.anlx.net/couchdb/0.9.1/apache-couchdb-0.9.1.tar.gz
tar zxvf apache-couchdb-0.9.1.tar.gz
cd apache-couchdb-0.9.1
./configure && make && sudo make install
@crofty
crofty / Monit installation and config on slicehost
Created September 9, 2009 11:35
Monit installation and config on Slicehost
sudo apt-get install monit
# Edit config file, example below
sudo vim /etc/monit/monitrc
# Check config syntax
sudo monit -t
# When no syntax errors edit the /etc/default/monit file to startup=1
sudo vim /etc/default/monit
# Start the service with:
sudo /etc/init.d/monit start
@crofty
crofty / Postfix installation on slicehost
Created September 9, 2009 11:29
Postfix installation on slicehost
# check the hostname, needed as part of install
hostname -f
sudo apt-get install postfix telnet mailx
# test with
mail [email protected]