Skip to content

Instantly share code, notes, and snippets.

View chris's full-sized avatar
🏠
Working from home

Chris Bailey chris

🏠
Working from home
View GitHub Profile
# This is for a WordPress installed at /var/www/wordpress/blog, and accessed at http://www.example.com/blog.
server {
listen 80;
server_name blog.example.com;
root /var/www/wordpress;
index index.php;
access_log /var/log/nginx/blog.access.log;
error_log /var/log/nginx/blog.error.log notice;
location /blog {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
proxy_pass http://IP-ADDRESS-OF-OTHER-SERVER;
}
@chris
chris / hack.sh
Created September 9, 2008 21:43
"hack" script for integrating changes into your working git branch
#!/bin/sh -x
# hack: Merge the latest changes from the master branch into your current branch
ref=$(git symbolic-ref HEAD 2> /dev/null) || exit 0
CURRENT="${ref#refs/heads/}"
git checkout master
git pull origin master
git checkout ${CURRENT}
git rebase master
@chris
chris / ship.sh
Created September 9, 2008 21:58
"ship" script for integrating changes in your working branch into the master branch and pushing to GitHub
#!/bin/sh -x
# Git workflow ship script from: http://reinh.com/blog/2008/08/27/hack-and-and-ship.html
# git name-rev is fail
ref=$(git symbolic-ref HEAD 2> /dev/null) || exit 0
CURRENT="${ref#refs/heads/}"
git checkout master
git merge ${CURRENT}
git push origin master
git checkout ${CURRENT}
@chris
chris / dwf.sh
Created September 9, 2008 22:12
dwf git script (Done With Feature)
#!/bin/sh -x
# dwf, aka "Done With Feature" script: deletes current branch and puts you back on master
ref=$(git symbolic-ref HEAD 2> /dev/null) || exit 0
CURRENT="${ref#refs/heads/}"
git checkout master
git branch -d ${CURRENT}
#!/usr/bin/env ruby
#
# Script to set all "fixed" Lighthouse tickets to deployed
require 'lighthouse_api/lighthouse'
Lighthouse.account = 'account' # put your account name in here
Lighthouse.token = 'abcdefghijklmnopqrstuvwxyz' # put your API token here
project = Lighthouse::Project.find(12345) # replace with your project's ID
# My .irbrc
require 'rubygems'
require 'irb/completion'
require 'pp'
require 'wirble'
Wirble.init
Wirble.colorize
# The following is a way to let you call various helpers from the Rails console, see:
-- Find duplicates in SQL from multiple columns
select name, email from emails group by name, email having count(*) > 1;
@chris
chris / .zshrc_prompt
Created November 8, 2008 05:32
zsh Git branch in your prompt
# zsh Git branch in your prompt, etc.
function precmd() {
# define colors
local RED="%{%}"
local LIGHT_RED="%{%}"
local CYAN="%{%}"
local LIGHT_CYAN="%{%}"
local BLUE="%{%}"
local LIGHT_BLUE="%{%}"
require 'autotest/redgreen'
module Autotest::Growl
def self.growl(title, msg, img, pri=0, stick="")
system "/usr/local/bin/growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}"
end
Autotest.add_hook :ran_command do |at|
results = at.results.last