Skip to content

Instantly share code, notes, and snippets.

View cwsaylor's full-sized avatar

Chris Saylor cwsaylor

View GitHub Profile
@cwsaylor
cwsaylor / gist:5649
Created August 15, 2008 21:30
Litespeed PHP Compile Params
--with-mysqli --with-mysql --with-zlib --with-gd --enable-shmop --enable-track-vars --enable-sockets --enable-sysvsem --enable-sysvshm --enable-magic-quotes --enable-mbstring --with-iconv --with-openssl
@cwsaylor
cwsaylor / Sakefile
Created August 22, 2008 04:10
Git sake tasks
namespace 'rails' do
desc 'Remove rails tmp dirs'
task 'rm_tmp_dirs' do
["./tmp/pids", "./tmp/sessions", "./tmp/sockets", "./tmp/cache"].each do |f|
system("rmdir ./#{f}")
end
end
end
namespace 'git' do
@cwsaylor
cwsaylor / data_scrub.rake
Created September 2, 2008 16:44
data_scrub.rake
# Scrub your production data for use in your development/staging environments. Sets all passwords to 12345
# and email addresses to your email address in the format of email+id@domain.com. Gmail (among others) allow
# you to add extra info to your email address with a +.
require 'digest/sha1'
class DBConn < ActiveRecord::Base
ActiveRecord::Base.configurations = YAML::load(File.open(File.join(RAILS_ROOT, 'config', 'database.yml')))
ENV['RAILS_ENV'] ||= 'development'
ActiveRecord::Base.establish_connection(ENV['RAILS_ENV'])
@cwsaylor
cwsaylor / bill_generator.rb
Created September 3, 2008 00:42
Script to generate a csv file of your future income, bills, expenses
#! /usr/bin/env ruby
# Usage: ruby bill_generator.rb data.yml 2008-1-1 2008-12-31
# Params: data file, begin date, end date
# begin and end date is in the format yyyy-mm-dd
# Sample data.yml file entries
# Date format is [yyyy, mm, dd]
#
@cwsaylor
cwsaylor / gist:8511
Created September 3, 2008 00:53
hack sink ship
# Variation on Hashrocket's script for managing the git process
# as documented here: http://reinh.com/blog/2008/08/27/hack-and-and-ship.html
# Create shell scripts out of each of these, put them in your path (~/bin for example)
# chmod 755 them and use like this:
#
# This version of hack is totally different than Hackrockets. I feel that hack implies
# that you are getting started, not finishing up. sink is Hashrockets hack.
#
# $ hack branch_name
# Test and Implement until done
@cwsaylor
cwsaylor / gist:17522
Created October 17, 2008 20:46
God init.d script
#!/bin/bash
#
# god Startup script for God monitoring tool.
#
# chkconfig: - 85 15
# description: god monitors your system
#
CONF_DIR=/etc/god/*
PID=/var/run/god.pid
# run with: god -c /etc/god/mongrel_cluster_god.rb or use an init.d script
#
# This god script will monitor all of your mongrels that are setup with mongrel_cluster.
# It can monitor multiple apps if the mongrel cluster configs are symlinked into a central directory like /etc/mongrel_cluster/
# Mongrels are grouped by name which is derived from the mongrel_cluster symlink name
# i.e. /etc/mongrel_cluster/foo.conf
# I have those usually symlinked into the shared folder of the app
# group would be foo so you can control the group like this: god restart foo
require 'yaml'
## ~/bin/hg-growl.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'ruby-growl'
require 'fileutils'
include FileUtils
config = ARGV[0] || "#{ENV['HOME']}/.hg-growl"
# Customize the terminal tabs
# put this in your .profile or .bashrc
function settitle() { echo -ne "\e]2;$@\a\e]1;$@\a"; }
function cd() { command cd "$@"; settitle `basename $(pwd)`; }
@cwsaylor
cwsaylor / gist:74430
Created March 5, 2009 16:46
Install ImageMagick for only manipulating image files
# Get http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
sudo mkdir -p /usr/local/man/man1
./configure --enable-shared --enable-static
make
sudo make install