Skip to content

Instantly share code, notes, and snippets.

View jsierles's full-sized avatar
🎯
Focusing

Joshua Sierles jsierles

🎯
Focusing
View GitHub Profile
# Taken from passenger_memory_stats script
# Returns the private dirty RSS for the given process, in KB.
def determine_private_dirty_rss(pid)
total = 0
File.read("/proc/#{pid}/smaps").split("\n").each do |line|
line =~ /^(Private)_Dirty: +(\d+)/
if $2
total += $2.to_i
end
upstream unicorn {
server unix:/u/apps/something/shared/sockets/unicorn.sock;
}
server {
listen 80;
server_name something.com;
access_log /u/apps/something/current/log/access.log main;
error_log /u/apps/something/current/log/error.log error;
writeboards:
enforce_writeboard_quota:
you_must_upgrade_before_you_can_add_more_writeboards_to_this_project: "You must upgrade before you can add more writeboards to this project."
require 'json'
require 'bunny'
class AMQPNotifierQueue
def initialize(options = {})
@amqp = Bunny.new(options)
@amqp.start
@exchange = @amqp.exchange('rails', :type => :topic)
@hostname = `hostname -s`
#if (NGX_HTTP_CACHE)
{
u_char *p, *last;
ngx_int_t n;
if (u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL) {
return NGX_OK;
}
if (r->cache == NULL) {
name "cf-stream"
description "CF Streaming API"
recipes "rails::apps"
default_attributes :active_groups => {:app => {:enabled => true}},
:active_applications => { "campfire" => { "env" => "production" }},
:rails => {:web_server => "nginx", :app_server => "thin"},
:sysctl => {
:settings => {
# General gigabit tuning:
require 'rubygems'
require 'thor'
class Test < Thor
class_options %w(password -p) => :required
def initialize(*)
super
puts options.inspect
end
#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require 'rubygems'
require 'thor'
require 'chef'
require 'chef/node'
require 'chef/role'
require 'chef/data_bag'
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
location / {
if ($request_method ~ ^OPTIONS|PROPFIND|REPORT$ ) {
return 403;
}
try_files /system/maintenance.html $uri @backend;
}
location @backend {