Skip to content

Instantly share code, notes, and snippets.

View denzuko's full-sized avatar
💬
linkedin.com/in/denzuko

Dwight Spencer denzuko

💬
linkedin.com/in/denzuko
View GitHub Profile
@denzuko
denzuko / Procfile
Created June 11, 2012 07:46 — forked from czottmann/Procfile
Example of a Foreman/Capistrano/upstart setup
worker: QUEUE=* bundle exec rake environment resque:work
scheduler: bundle exec rake environment resque:scheduler
@denzuko
denzuko / Gemfile
Created June 15, 2012 01:07 — forked from juhat/Gemfile
Guard & Foreman setup
group :test, :development do
gem 'guard-rspec'
gem 'guard-cucumber'
gem 'libnotify'
gem 'foreman'
end
@denzuko
denzuko / gist:2986054
Created June 25, 2012 02:20 — forked from gerhard/gist:1852864
Deliver vs git-hooks

Why not just use git hooks?

  1. They run in the background, thus there is no visibility as to whether they succeed or fail.

  2. Deploying an app from start to finish involves multiple users, and if done right requires sudo privileges. The system user under which the app runs must not have sudo privileges, but the app itself would use Foreman ideally. If you export to Sys V or Upstart, you will need sudo privileges.

@denzuko
denzuko / two_factor_ssh.rb
Created June 26, 2012 11:50 — forked from moomerman/two_factor_ssh.rb
Two Factor SSH Authentication
#!/usr/bin/env ruby
require 'rubygems'
require 'rotp'
require 'time'
user = ARGV[0]
secret = ARGV[1]
abort unless user and secret
trap("INT") do
@denzuko
denzuko / gist:3201864
Created July 29, 2012 21:14 — forked from anildigital/gist:410309
Awesome unicorn config.
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@denzuko
denzuko / installation.sh
Created July 30, 2012 00:59 — forked from mikhailov/installation.sh
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ sudo apt-get install openssl-dev
$ gem install passenger -v=3.0.12 --no-ri --no-rdoc
$ passenger-install-nginx-module --extra-configure-flags="--with-pcre=/usr/src/pcre-8.30 --with-openssl-opt=no-krb5 --with-http_gzip_static_module --with-http_stub_status_module --without-mail_pop3_module --without-mail_smtp_module --without-mail_imap_module"
@denzuko
denzuko / contact-form.rb
Created August 3, 2012 17:18 — forked from vitobotta/contact-form.rb
A Sinatra-powered contact form for Jekyll
# See blog post at http://vitobotta.com/sinatra-contact-form-jekyll/
%w(rubygems sinatra liquid active_support/secure_random resolv open-uri pony haml).each{ |g| require g }
APP_ROOT = File.join(File.dirname(__FILE__), '..')
set :root, APP_ROOT
set :views, File.join(APP_ROOT, "_layouts")
not_found do
@denzuko
denzuko / ditz.vim
Created August 18, 2012 14:36 — forked from ursm/ditz.vim
function! s:Todo()
call s:OpenBufferFromCommand('ditz todo', function('s:IssueCallback'))
endfunction
function! s:TodoAll()
call s:OpenBufferFromCommand('ditz todo --all', function('s:IssueCallback'))
endfunction
function! s:Grep(args)
call s:OpenBufferFromCommand(printf('ditz grep "%s"', a:args), function('s:IssueCallback'))
@denzuko
denzuko / gist:3393753
Created August 19, 2012 08:47 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@denzuko
denzuko / Jabber-SH
Created September 7, 2012 02:37 — forked from pcreux/Jabber-SH
Jabber-SH — SH console via XMPP/Jabber (GTalk) Jabber-SH allows to you to administrate a remote computer via a command line through a Jabber client. It’s like SSH via GoogleTalk! :)
#!/usr/bin/env ruby
# Jabber-SH — SH console via XMPP/Jabber (GTalk)
#
# Jabber-SH allows you to administrate a remote computer via a command line
# through a Jabber client. It’s like SSH via GoogleTalk! :)
# This is just a hack but it might be usefull sometime to run basic commands
# on a machine that is not accessible via ssh.
#
# Philippe Creux. pcreux/AT/gmail/DOT/com