Skip to content

Instantly share code, notes, and snippets.

View phumpal's full-sized avatar
🌮

Patrick Humpal phumpal

🌮
  • Northern California
View GitHub Profile
@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@ancorcruz
ancorcruz / thinking_sphinx)
Created July 31, 2009 10:03
Thinking Sphinx init.d script
#!/bin/bash -e
### BEGIN INIT INFO
# Provides: thinking_sphinx
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop Sphinx daemon for Thinking Sphinx
### END INIT INFO
CONFIG_FILE=/etc/default/thinking_sphinx.conf
. $CONFIG_FILE || exit
@chmouel
chmouel / upload-to-rackspace-cloud-file.sh
Created June 9, 2010 18:53
Upload to RackSpace CloudFiles from shell with curl.
#!/bin/bash
# Author: Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
# Not officially supported by Rackspace only as a best effort basis :)
# Define yes to make it to copy to url to clipboard (via a shortened url
# service) You need to have the software xclip installed in your system.
COPY_URL_TO_CLIPBOARD=yes
# Containers to ignore in the list
CONTAINERS_TO_IGNORE=".CDN_ACCESS_LOGS"
if node[:ec2][:ephemeral][:devices].include?("/dev/sdd")
# if we also have sdd and sde, raid0 them and put data there
data_raid_block_devs = [ "/dev/sdd", "/dev/sde" ]
data_raid_mountpoint = "/mnt/cassandra_data"
data_raid_dev = "/dev/md0"
data_file_dir = Array(node[:cassandra][:data_file_dirs]).first
package "mdadm" do
action :install
end
@samuel
samuel / backup.py
Created November 8, 2010 22:42
A script to automate freezing XFS and locking MongoDB and snapshotting EBS volumes
#!/usr/bin/env python
from __future__ import with_statement
import contextlib
import logging
import os
import sys
import urllib2
from boto.ec2.connection import EC2Connection
@lusis
lusis / create_ebs.rb
Created December 2, 2010 06:58
Small script to setup ec2 instances and EBS volumes for my blog post series
# Create 4 volumes and attach them to hdb
%w[sdi sdj sdk sdl].each do |dev|
volume = AWS.volumes.new :device => "/dev/#{dev}", :size => 5, :availability_zone => hdb.availability_zone
volume.server = hdb
volume.save
end
Bluepill.application("THEAPP") do | app |
["mail"].each do |worker_type|
app.process(worker_type+"_worker") do |process|
process.group = "workers"
#Refactor this into using rails_env and rails_root variables
process.start_command = "cd /home/........production; QUEUE="+worker_type+" rake environment resque:work RAILS_ENV=production"
process.daemonize = true
process.pid_file = "/tmp/"+worker_type+"_worker.pid"
process.start_grace_time = 3.seconds
process.stop_grace_time = 5.seconds
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@tnine
tnine / ebs_raid.rb
Created April 27, 2011 03:03
Ebs raid mounting. Links to this jira issue http://tickets.opscode.com/browse/CHEF-2275
include Opscode::Aws::Ec2
#Auto locates and attached ebs devices based on the data bag they reside in. The following test cases need to be performed
# Create multiple resources with new node: PASS
#
# Re-attach multiple resources after a reboot: PASS
#
# Create resources across 2 runs. First run creates first raid set, second run re-attaches then creates: PASS
#
@nstielau
nstielau / send_metric_to_statsd.sh
Created May 11, 2011 16:41
Send a metric to StatsD from bash
# Send a metric to statsd from bash
#
# Useful for:
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/)
# init scripts
# sending metrics via crontab one-liners
# sprinkling in existing bash scripts.
#
# netcat options:
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed.