Skip to content

Instantly share code, notes, and snippets.

@schleg
schleg / gist:ecd0e326497a74a10a3a
Last active August 29, 2015 14:06
docker-setup-ubuntu-linode
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
echo "deb http://get.docker.io/ubuntu docker main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y lxc-docker
su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm'
sudo yum -y install docker-io
vim /etc/cgconfig.conf # comment out the memory line
sudo service docker start
sudo chkconfig docker on
sudo docker pull centos:latest
May 6, 2014 9:27:46 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
May 6, 2014 9:27:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
May 6, 2014 9:27:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
May 6, 2014 9:27:47 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 637 ms
May 6, 2014 9:27:47 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
@schleg
schleg / README.md
Last active August 29, 2015 14:00 — forked from jpantuso/README.md

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup

#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
# verified to work on DigitalOcean Ubuntu 12.10 X32 Server instance
# prerequisites
sudo addroup admin
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev gcc git make zsh
chsh -s /bin/zsh
# oh-my-zsh
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
@schleg
schleg / install.sh
Created August 30, 2012 02:18 — forked from maggit/install.sh
Chef installer for OS X 10.8 Mountain Lion
#!/bin/bash
# This is the current stable release to default to, with Omnibus patch level (e.g. 10.12.0-1)
# Note that the chef-full template downloads 'x.y.z' not 'x.y.z-r' which should be a duplicate of the latest -r
release_version="10.12.0-1"
use_shell=0
# Check whether a command exists - returns 0 if it does, 1 if it does not
exists() {
if command -v $1 &>/dev/null
# app/models/<Your Model>.rb
has_attached_file :<the_image_attribute_name>, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :storage => :s3, :path => ":attachment/:id/:style.:extension", :bucket => '<your_image_bucket>', :s3_credentials => "#{::Rails.root.to_s}/config/amazon_s3.yml"
@schleg
schleg / Basecamp.rb
Created September 20, 2011 19:23
Basecamp API lib; Rails 3 compatible
require 'net/https'
require 'yaml'
require 'date'
require 'time'
begin
require 'xmlsimple'
rescue LoadError
begin
require 'rubygems'
@schleg
schleg / redirect_once_to
Created September 3, 2011 22:24
one time redirect
def redirect_once_to(path)
route = ActionController::Routing::Routes.recognize_path(path)
redirect_to path unless route[:controller] == controller_name && route[:action] == action_name
end