Skip to content

Instantly share code, notes, and snippets.

@hedgehog
hedgehog / dba-user.json
Created June 2, 2011 23:03 — forked from lusis/dba-user.json
Managing MySQL user accounts with Chef
{
"id":"dbauser",
"uid":506,
"comment":"DBA User",
"shell":"/bin/bash",
"groups": [
"sysadm",
"dba"
],
"ssh_key": "XXXXXXXXXX"
@hedgehog
hedgehog / deploy.rake
Created June 6, 2011 23:41 — forked from sandro/deploy.rake
WIP Whiskey Disk deployment with db backup and lesscss generation
require 'whiskey_disk/rake'
require 'whiskey_disk/helpers'
namespace :deploy do
ENV['to'] ||= 'staging'
def verbose_cmd(cmd)
system %(set -x && #{cmd})
end
# Dicking around with various setups
# We can define the custom hooks in the deploy rake task itself because
# rake is still the main interface for deployments - no need for a
# separate whiskey_disk_hooks.rb file
require 'whiskey_disk/rake'
# I don't love the way this turned out but the ideas is that WhiskeyDisk
# provides a command-api to build local and remote commands.
class GemCache < WhiskeyDisk::Command
@hedgehog
hedgehog / ubuntu.sh
Created June 9, 2011 05:48 — forked from DAddYE/ubuntu.sh
Install Padrino on Ubuntu
# Setup Ubuntu LTS 10.4
sudo apt-get install ruby
sudo apt-get install ruby-dev
sudo apt-get install sqlite
sudo apt-get install libsqlite3-dev
sudo apt-get install irb
sudo apt-get install rdoc
sudo apt-get install libopenssl-ruby
sudo apt-get install g++
wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
@hedgehog
hedgehog / split_repo.bash
Created June 14, 2011 10:56 — forked from pk/split_repo.bash
Extract directory from the GIT repo to the standalone GIT repo.
#!/bin/bash
FROM=$1
TO=$2
echo "Spliting '$TO' from '$FROM'"
git clone --no-hardlinks $FROM $TO
cd $TO
git filter-branch --subdirectory-filter $TO HEAD -- --all
git reset --hard
git gc --aggressive
git prune
@hedgehog
hedgehog / chef-010-apt.erb
Created June 15, 2011 06:02 — forked from jtimberman/chef-010-apt.erb
Bootstrap template for chef 0.10 with apt.opscode.com, save as ~/.chef/bootstrap/chef-010-apt.erb
bash -c '
if [ ! -f /usr/bin/chef-client ]; then
echo "chef chef/chef_server_url string <%= Chef::Config[:chef_server_url] %>" | debconf-set-selections
[ -f /etc/apt/sources.list.d/opscode.list ] || echo "deb http://apt.opscode.com `lsb_release -cs`-0.10 main" > /etc/apt/sources.list.d/opscode.list
wget -O- http://apt.opscode.com/[email protected] | apt-key add -
fi
apt-get update
apt-get install -y chef
<% unless Chef::Config[:validation_client_name] == "chef-validator" -%>
@hedgehog
hedgehog / ubuntu10.04-ruby192.erb
Created June 15, 2011 06:03 — forked from czottmann/ubuntu10.04-ruby192.erb
Ubuntu 10.04 + Ruby 1.9.2p180 chef bootstrap file
bash -c '
if [ ! -f /usr/local/bin/chef-client ]; then
apt-get update
apt-get -y upgrade
apt-get install -y build-essential wget zlib1g-dev libssl-dev libffi-dev
cd /usr/src
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.bz2
tar xjf ruby-1.9.2-p180.tar.bz2
cd ruby-1.9.2-p180
./configure

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
#!/bin/sh
# standard ubuntu gem pakage adds alternative for gem
# it should be removed first time
#
# update-alternatives --remove-all gem
update-alternatives --remove-all ruby
update-alternatives --install /usr/bin/ruby ruby /opt/ruby-enterprise/bin/ruby 600 \
# Author:: Adam Jacob <[email protected]>
# Author:: Joshua Timberman <[email protected]>
#
# Copyright 2009-2010, Opscode, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0