Skip to content

Instantly share code, notes, and snippets.

View dstrelau's full-sized avatar

Dean Strelau dstrelau

View GitHub Profile
#!/bin/sh
NAME=nginx
DESC=nginx
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/nginx
DAEMON_ARGS=""
CONFIG=/etc/nginx/nginx.conf
PID_FILE="/var/run/${NAME}.pid"
[~] gem i mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/Users/dstrelau/.rvm/ruby-enterprise-1.8.7-20090928/bin/ruby extconf.rb
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
POSSIBLE = [('a'..'z'),('A'..'Z'),(0..9),'.','/'].inject([]) {|s,r| s+Array(r)}
def shadow(password)
salt = Array.new(8) { POSSIBLE[ rand(POSSIBLE.size) ] }
password.crypt("$1$#{salt}")
end
source "http://gems.github.com"
source "http://gemcutter.org"
bundle_path "vendor/bundled_gems"
gem "rails", "2.3.4"
gem "aasm", "2.1.1"
gem "activemerchant", "1.4.2", :require_as => "active_merchant"
gem "alchemy", "0.11.2" ### A private gem. It depends on "httparty", "> 0.3"
gem "fastercsv", "1.5.0"
#!/usr/bin/env ruby
require 'typhoeus'
HOST = 'http://yourhost.com'
CONCURRENTS = 5
urls = File.readlines(ARGV.shift)
hydra = Typhoeus::Hydra.new
queue_req = lambda do |resp|
[~] brew install redis
/usr/local/Library/Formula/redis.rb:3: warning: already initialized constant REDIS_CONF
==> Downloading http://redis.googlecode.com/files/redis-1.02.tar.gz
######################################################################## 100.0%
==> make
/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -c -O4 -march=core2 -mmmx -msse3 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -g -rdynamic -ggdb adlist.c
/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -c -O4 -march=core2 -mmmx -msse3 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -g -rdynamic -ggdb ae.c
/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -c -O4 -march=core2 -mmmx -msse3 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -g -rdynamic -ggdb anet.c
/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -c -O4 -march=core2 -mmmx -msse3 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -g -rdynamic -ggdb dict.c
/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -c -O4 -march=core2 -mmmx -msse3 -w -pipe -fomit-frame-pointer
server {
error_page 503 @503;
location = /503.html { }
location = /down_for_maintenance.html { }
location @503 {
# If we are in maintenance mode and returning a 503,
# show the special maintenance page
if ( -f $document_root/SHOW_MAINTENANCE_PAGE ) {
rewrite ^.*$ /down_for_maintenance.html;
#
# Rack middleware to log both request info and server response.
#
# Usage:
# use RequestResponseLogger,
# :logfile => Rails.root.join('log','mobile.log'),
# :path => /^\/mobile\//
class RequestResponseLogger
def initialize(app, options={})

Coding Rails with Homebrew

Right now, this assumes you are using Snow Leopard.

Install Homebrew

Homebrew is MacPorts (or APT) without the suck. http://github.com/mxcl/homebrew

[~] brew install libwmf
==> Downloading http://downloads.sourceforge.net/project/wvware/libwmf/0.2.8.4/libwmf-0.2.8.4.tar.gz
File already downloaded and cached to /Users/dstrelau/Library/Caches/Homebrew
==> ./configure --prefix=/usr/local/Cellar/libwmf/0.2.8.4 --disable-debug
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk