Skip to content

Instantly share code, notes, and snippets.

View n3bulous's full-sized avatar

Kevin McFadden n3bulous

View GitHub Profile
@n3bulous
n3bulous / sphinx.rb
Created July 20, 2012 18:56 — forked from twerth/sphinx.rb
Mac homebrew Sphinx 0.9.9 formula
require 'formula'
class Libstemmer < Formula
# upstream is constantly changing the tarball,
# so doing checksum verification here would require
# constant, rapid updates to this formula.
head 'http://snowball.tartarus.org/dist/libstemmer_c.tgz'
homepage 'http://snowball.tartarus.org/'
end
@n3bulous
n3bulous / Gemfile
Created July 25, 2012 01:49 — forked from mm53bar/Gemfile
Automagically launch an EC2 image and then provision it using sunzi
source 'http://rubygems.org'
gem 'sunzi'
gem 'rake'
gem 'fog'
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY!
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
# An example of the below
virtualenv "/home/dvcsmirrors/hg" do
owner "root"
group "dvcsmirrors"
mode 0775
packages "Mercurial" => "1.6.3",
"hgsubversion" => "1.1.2"
end
@n3bulous
n3bulous / 0_reuse_code.js
Created January 3, 2014 02:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am n3bulous on github.
  • I am kmcfadden (https://keybase.io/kmcfadden) on keybase.
  • I have a public key whose fingerprint is CFB8 A03D 32F5 75C5 0B43 F2F7 68BC 0C53 69A2 0530

To claim this, I am signing this object:

#!/bin/bash
#
# The MIT License
#
# Copyright 2014 Jakub Jirutka <[email protected]>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
DELIMITER |
CREATE FUNCTION uuid_from_bin(b BINARY(16))
RETURNS CHAR(36) DETERMINISTIC
BEGIN
DECLARE hex CHAR(32);
SET hex = HEX(b);
RETURN LOWER(CONCAT(LEFT(hex, 8), '-', MID(hex, 9,4), '-', MID(hex, 13,4), '-', MID(hex, 17,4), '-', RIGHT(hex, 12)));
END
|
@n3bulous
n3bulous / README.md
Last active January 12, 2016 21:31 — forked from magnetikonline/README.md
AWS Elastic Beanstalk deploy user restricted IAM policy.

AWS Elastic Beanstalk deploy user restricted IAM policy

An IAM user policy document to give minimal rights for deploying an Elastic Beanstalk application.

Where:

  • REGION: AWS region.
  • ACCOUNT_ID: AWS account ID.
  • APPLICATION_NAME: Desired target Elastic Beanstalk application name(space).
  • IAM_INSTANCE_PROFILE_ROLE: The instance profile (IAM role) Elastic Beanstalk EC2 instaces will run under.
@n3bulous
n3bulous / add_environment_to_host.rb
Created November 2, 2016 14:24
Idempotent Rails Migrations for Columns
class AddEnvironmentToHost < ActiveRecord::Migration
def self.up
- add_column :hosts, :environment, :string
+ unless ActiveRecord::Base.connection.columns(:hosts).collect {|c| c.name}.include?("environment")
+ add_column :hosts, :environment, :string
+ end
end
def self.down
- remove_column :hosts, :environment