Skip to content

Instantly share code, notes, and snippets.

@zh
zh / polycorn.md
Created October 22, 2013 02:48 — forked from octplane/polycorn.md

Life and death of Unicorns

The introduction of our Unicorn management tool, Polycorn.

jump into our train!

Photo by Protohiro from Flickr

At Fotopedia, we use Unicorn to serve our main Rails application. Every day, we restart our application several times, spawning and killing hundred of Unicorns. Managing graceful restarts is a complex task, and requires careful monitoring and command. This article introduces our tool Polycorn, a Unicorn management program.

[[MORE]]

@zh
zh / default.rb
Created December 3, 2012 14:36 — forked from wilmoore/default.rb
DIY Private Cloud w/ VirtualBox and Chef
# Cookbook Name:: mongodb
# Recipe:: default
case node['platform']
when "ubuntu"
execute "apt-get update" do
action :nothing
end
execute "add gpg key" do
@zh
zh / uninstall_homebrew.sh
Created November 29, 2012 14:56 — forked from mxcl/uninstall_homebrew.sh
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@zh
zh / rails-install.sh
Created November 29, 2012 14:26
New OS X machine setup for Ruby/Rails development
#!/bin/sh
# Purpose: setup new OS X machine for Ruby/Rails development
# Pre-Requirements: GCC (https://github.com/kennethreitz/osx-gcc-installer)
# Usage: bash < <(curl -fsSkL https://raw.github.com/gist/4169434/rails-install.sh)
RUBY_VERSION="1.9.3-p327"
if [[ `which gcc` == "" ]]; then
echo "[E] Please install GCC first. Exiting."
exit 1
@zh
zh / rbenv-install.sh
Created November 26, 2012 12:53
Install Ruby via rbenv (and ruby-build) on Ubuntu Linux
#!/bin/bash
#
# Purpose: install ruby + rbenv on Ubuntu Linux
VERSION="1.9.3-p327"
echo "[*] --> Updates packages lists." 1>&2
sudo apt-get update -y
echo "[*] --> Installs curl and GIT packages." 1>&2
sudo apt-get git-core curl -y
@zh
zh / main.c
Created October 29, 2012 08:41 — forked from holachek/main.c
AVR Tutorial main.c
#define F_CPU 1000000 // CPU frequency for proper time calculation in delay function
#include <avr/io.h>
#include <util/delay.h>
int main (void)
{
DDRD |= (1 << PD6); // make PD6 an output
for(;;)
{
PORTD ^= (1 << PD6); // toggle PD6
@zh
zh / Makefile
Created October 29, 2012 08:41 — forked from holachek/Makefile
AVR Tutorial Makefile
# Name: Makefile
# Author: <insert your name here>
# Copyright: <insert your copyright message here>
# License: <insert your license reference here>
# DEVICE ....... The AVR device you compile for
# CLOCK ........ Target AVR clock rate in Hertz
# OBJECTS ...... The object files created from your source files. This list is
# usually the same as the list of source files with suffix ".o".
# PROGRAMMER ... Options to avrdude which define the hardware you use for
@zh
zh / osx_developer_installation.rst
Created October 22, 2012 07:27 — forked from stefanfoulis/osx_developer_installation.rst
Instructions on how to setup an OSX developer machine for (python/django) development

OSX Developer System installation

This guide assumes a fresh install of Mac OSX 10.7 Lion.

Homebrew

@zh
zh / deploy.rb
Created July 20, 2012 06:23 — forked from ahawkins/deploy.rb
Deploy script for Heroku apps
#!/usr/bin/env ruby
# This is a basic deploy script for Heroku apps.
# It provides a structure you can use to expand on
# and add your own prereqs and deploy tasks.
#
# It basically ensures that:
# 1. There are no uncommited files
# 2. You can ssh to github
# 3. You can connect to heroku
@zh
zh / rbenv-howto.md
Created July 5, 2012 07:26 — forked from MicahElliott/rbenv-howto.md
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev