Skip to content

Instantly share code, notes, and snippets.

@nateware
nateware / haproxy.conf
Created October 31, 2012 15:36
HAProxy sample config for EC2
#
# This config file is a combination of ideas from:
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/
# http://wiki.railsmachine.com/HAProxy
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/
# http://wiki.railsmachine.com/HAProxy
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9
#
@cmaitchison
cmaitchison / chef_solo_bootstrap.sh
Created August 17, 2012 09:45
CentOS 6.3 Chef-Solo bootstrap (RackSpace)
#!/bin/bash -xe
#THIS SCRIPT MUST BE RUN AS ROOT
ADMIN_USER=admin
ADMIN_GROUP=admin
#add admin group
(cat /etc/group | grep -E '\b$ADMIN_GROUP\b') || sudo groupadd $ADMIN_GROUP
@sr75
sr75 / Gemfile
Created July 25, 2012 01:36 — forked from flomotlik/Gemfile
Unicorn config for cedar stack on Heroku.
gem 'unicorn'
@mikhailov
mikhailov / 0. nginx_setup.sh
Last active April 2, 2024 14:57
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@sr75
sr75 / .gitconfig
Last active October 24, 2019 21:17
gitconfig for git v1.8+ with terminal color and command aliases
[user]
name = yourname
email = yourname @ whatever
[core]
excludesfile = yourhomedir/.gitignore
#git config --global core.eol lf
#git config --global core.autocrlf input
eol = lf
autocrlf = input
#git rm -rf --cached .
@sr75
sr75 / centos6-barebones-vps-rails-server-walkthrough
Last active October 2, 2015 12:38
centos6-barebones-vps-rails-server-walkthrough (rvm, nginx, mysql, memcached)
# CentOS 6.4 barebones walkthrough guide for a new vps rails server instance
# assumes you already have a personal ssh key locally
#
# script implements the following security approaches:
# disables root login
# configures ssh setup for deployer user
# opens up standard ports
#
# setup includes:
# rvm & ruby-1.9.3-p429
@t2
t2 / application.rb
Created December 12, 2011 02:13
Formatting Rails form elements for Twitter Bootstrap error validation
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
html = %(<div class="field_with_errors">#{html_tag}</div>).html_safe
# add nokogiri gem to Gemfile
elements = Nokogiri::HTML::DocumentFragment.parse(html_tag).css "label, input"
elements.each do |e|
if e.node_name.eql? 'label'
html = %(<div class="clearfix error">#{e}</div>).html_safe
elsif e.node_name.eql? 'input'
if instance.error_message.kind_of?(Array)
html = %(<div class="clearfix error">#{html_tag}<span class="help-inline">&nbsp;#{instance.error_message.join(',')}</span></div>).html_safe
@brentertz
brentertz / rvm2rbenv.txt
Created November 21, 2011 23:00
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
@fernandoaleman
fernandoaleman / rpm-digital-signature.sh
Created November 18, 2011 15:18
How to sign your custom RPM package with GPG key
# How to sign your custom RPM package with GPG key
# Step: 1
# Generate gpg key pair (public key and private key)
#
# You will be prompted with a series of questions about encryption.
# Simply select the default values presented. You will also be asked
# to create a Real Name, Email Address and Comment (comment optional).
#
# If you get the following response:
@czottmann
czottmann / Procfile
Created June 15, 2011 13:43
Example of a Foreman/Capistrano/upstart setup
worker: QUEUE=* bundle exec rake environment resque:work
scheduler: bundle exec rake environment resque:scheduler