Skip to content

Instantly share code, notes, and snippets.

View lunaisnotaboy's full-sized avatar
🏳️‍⚧️
nya

Luna Nova lunaisnotaboy

🏳️‍⚧️
nya
View GitHub Profile
# 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
@defunkt
defunkt / unicorn.rb
Created November 10, 2009 22:56
Unicorn Capistrano Tasks
# http://unicorn.bogomips.org/SIGNALS.html
namespace :unicorn do
task :start, :roles => :app do
sudo "god start unicorn"
end
task :stop, :roles => :app do
sudo "god stop unicorn"
end
@defunkt
defunkt / failbot.rb
Created February 9, 2010 18:07
Example Custom Resque Failure Backend
module Resque
module Failure
class Failbot < Base
def self.url
"http://haystack/types/exception"
end
def self.count
# Fake it for now.
Stat[:failed]
@defunkt
defunkt / gist:306493
Created February 17, 2010 10:30
I am a php programmer learning Ruby and Rails.
From: Chris Wanstrath <[email protected]>
Date: Mon, Mar 28, 2005 at 7:43 AM
Subject: Ruby on Rails
To: Amy Hoy
Hey!
I just found your Slash7 blog and love it.  I am a php programmer
learning Ruby and Rails every free second I have, and your cheat
sheets are prominently and helpfully posted on my wall.  I'm looking
forward to your next entry on Rails.  Thanks again.
@defunkt
defunkt / camp.rb
Created February 18, 2010 23:19
The first GitHub webhook consumer (Campfire Notifier)
require 'rubygems'
require 'sinatra'
require 'json'
require '/var/www/famspam/production/current/lib/campfire'
post '/' do
payload = JSON.parse(params[:payload])
messages = []
repository = payload['repository']
@defunkt
defunkt / config.ru
Created June 3, 2010 19:36
Rails < 2.3 on Rack
# Because Unicorn is such a brilliant piece of software, it wraps older,
# non-Rack versions of Rails in a Rack handler. That way Unicorn
# itself can target Rack and not have to worry about monkey patching
# Rails' dispatcher.
#
# This means we can do the same, and even more.
#
# Starting Rackhub locally:
#
# Thin:
@benburkert
benburkert / dpkg.rb
Created August 10, 2011 19:36 — forked from jedi4ever/dpkg-gnutar
homebrew formula to get dpkg working on a mac
require 'formula'
class Dpkg <Formula
url 'https://launchpad.net/debian/+archive/primary/+files/dpkg_1.16.0.3.tar.bz2'
homepage 'http://en.wikipedia.org/wiki/Dpkg'
md5 '0266b06ef9da8278cea008d21e17e5f6'
depends_on 'gnu-tar'
def patches
@isa
isa / gist:1776881
Created February 9, 2012 02:58
Windows 2000 Source Code
/* Source Code Windows 2000 */
#include "win31.h"
#include "win95.h"
#include "win98.h"
#include "workst~1.h"
#include "evenmore.h"
#include "oldstuff.h"
#include "billrulz.h"
#include "monopoly.h"
@klange
klange / _.md
Last active December 23, 2024 14:40
It's a résumé, as a readable and compilable C source file. Since Hacker News got here, this has been updated to be most of my actual résumé. This isn't a serious document, just a concept to annoy people who talk about recruiting and the formats they accept résumés in. It's also relatively representative of my coding style.

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le
admin@github-int-yammer-com:~$ ls -alh /data/enterprise
total 64K
drwxr-xr-x 2 root root 4.0K 2013-01-14 12:02 .
drwxr-xr-x 15 git git 4.0K 2012-08-15 14:28 ..
lrwxrwxrwx 1 root root 37 2013-01-14 12:02 chef.log -> /var/log/chef/chef.20130114120254.log
-rw-r--r-- 1 root root 77 2013-01-14 07:25 chef_metadata.json
lrwxrwxrwx 1 root root 30 2013-01-14 12:02 code_debs -> /data/enterprise/ghp/code_debs
lrwxrwxrwx 1 root root 30 2013-01-14 12:02 cookbooks -> /data/enterprise/ghp/cookbooks
-rw-r--r-- 1 root root 2.7K 2012-02-07 00:55 customer.gpg
-rw-r--r-- 1 root root 19K 2013-01-14 12:02 dna.json