This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NGINX_VERSION=1.3.4 | |
TMP_PATH=/tmp | |
# Fetch and extract nginx source | |
cd $TMP_PATH | |
wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | |
tar xvfz nginx-$NGINX_VERSION.tar.gz | |
cd nginx-$NGINX_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Make sure we have the latest package info | |
apt-get update | |
# Install ruby 1.9 and some other useful related packages | |
apt-get install -y ruby1.9.3 build-essential libssl-dev zlib1g-dev | |
# Let "update-alternatives" know about the new ruby | |
update-alternatives \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Quickly set up a server the way I like it (dotfiles + zsh + oh-my-zsh) | |
# | |
# Requires git and zsh to be installed on the machine | |
# | |
# Usage: | |
# curl https://raw.github.com/gist/2945733/82c7487f5a4d99508e7a6150dfa88156b8e88943/dotfiles.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NGINX_VERSION=1.3.8 | |
TMP_PATH=/tmp | |
# Fetch and extract Nginx | |
cd $TMP_PATH | |
wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | |
tar xvfz nginx-$NGINX_VERSION.tar.gz | |
cd nginx-$NGINX_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 443 ssl spdy default_server; | |
server_name example.com; | |
ssl_certificate /etc/ssl/certs/my.ssl.crt; | |
ssl_certificate_key /etc/ssl/private/my.ssl.key; | |
root /mysite/current/public; | |
passenger_enabled on; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this in an initializer | |
old_prompt = Pry.config.prompt | |
Pry.config.prompt = [ | |
proc {|a,b,c| "\e[31m#{(Rails.env.upcase)}\e[0m #{old_prompt.first.call(a,b,c)}"}, | |
proc {|a,b,c| "\e[31m#{(Rails.env.upcase)}\e[0m #{old_prompt.second.call(a,b,c)}"}, | |
] unless Rails.env.development? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automatically generates the plain-text version of emails from the html | |
# template using premailer. | |
class SmartMailer < ActionMailer::Base | |
def mail(headers={}) | |
# Configure the premailer options | |
premailer_options = { | |
with_html_string: true, | |
line_length: 9999, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Batman.LayoutController extends Batman.Controller | |
render: (options = {}) -> | |
layout = options.layout ? @layout ? Batman.helpers.underscore(@get('routingKey')) | |
if layout | |
# Prefetch the action's view in parallel | |
source = options.source || Batman.helpers.underscore(@get('routingKey') + '/' + @get('action')) | |
Batman.View.store.prefetch source | |
# Fetch the layout's view and apply context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the AWS instance ID for the current instance, no API credentials required | |
curl http://169.254.169.254/2009-04-04/meta-data/instance-id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo pip install -Iv http://gdata-python-client.googlecode.com/files/gdata-2.0.14.tar.gz googlecl |