Skip to content

Instantly share code, notes, and snippets.

View phumpal's full-sized avatar
🌮

Patrick Humpal phumpal

🌮
  • Northern California
View GitHub Profile
@chris
chris / nodejs_recipe.rb
Created May 13, 2011 05:55
Chef recipe to install node.js on Engine Yard AppCloud
#
# Cookbook Name:: nodejs
# Recipe:: default
#
# Build and install node.js
#
if ['app','app_master','solo'].include?(node[:instance_role])
version_tag = "v0.4.8"
source_base_dir = "/data/nodejs"
@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@HatemMahmoud
HatemMahmoud / Ubuntu rbenv
Created September 7, 2011 12:56
Installing Ruby 1.9.2 with OpenSSL on Ubuntu 11.04 using ruby-build and rbenv
# for more info: https://gist.github.com/1120938
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@jnx
jnx / rbenv-install-system-wide.sh
Created October 1, 2011 20:09
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@andreacfm
andreacfm / resque_worker_upstart.sh
Created October 3, 2011 15:33
resque workers via upstart runned by unpriviledge user
#!upstart
description "Workers [resque]"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn
respawn limit 99 5
console none
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@perusio
perusio / gist:1326701
Created October 31, 2011 01:28
Mobile device detection in Nginx with just 7 lines of configuration
### Testing if the client is a mobile or a desktop.
### The selection is based on the usual UA strings for desktop browsers.
## Testing a user agent using a method that reverts the logic of the
## UA detection. Inspired by notnotmobile.appspot.com.
map $http_user_agent $is_desktop {
default 0;
~*linux.*android|windows\s+(?:ce|phone) 0; # exceptions to the rule
~*spider|crawl|slurp|bot 1; # bots
~*windows|linux|os\s+x\s*[\d\._]+|solaris|bsd 1; # OSes
@memonic
memonic / cronjob.sh
Created December 15, 2011 13:04
Script to transform Amazon RDS slow log table into the MySQL slow query log format
#!/bin/bash
(/usr/local/bin/db2log | \
mk-query-digest --fingerprints \
--filter '$event->{user} !~ m/^(bi|memonic)$/') 2>&1 | \
mail -s "MySQL slow logs" root
# Rotate slow logs. Will move them into the backup table slow_log_backup. If
# that table exists it's overwritten with the primary slow log.
# So with this strategy we can still access yesterday's slow log by querying
# slow_log_backup.
@finack
finack / application.rb
Created March 17, 2012 06:18
Example Chef Deploy Revision for Rails 3+
app = node[:rails][:app]
rails_base app[:name] do
ruby_ver app[:ruby_ver]
gemset app[:gemset]
end
%w{config log pids cached-copy bundle system}.each do |dir|
directory "#{app[:app_root]}/shared/#{dir}" do
owner app[:deploy_user]