Skip to content

Instantly share code, notes, and snippets.

View wijet's full-sized avatar

Mariusz Pietrzyk wijet

View GitHub Profile
class Chef
module DSL
module DataQuery
# http://tickets.opscode.com/browse/CHEF-3832
# Monkey patched so that search always returns nodes sorted by name
def search(*args, &block)
if Kernel.block_given? || args.length >= 4
Chef::Search::Query.new.search(*args, &block)
else
results = Array.new
@wijet
wijet / Running this thing
Last active December 17, 2015 16:59
Configuration which makes puma leak file descriptors
# haproxy version: 1.4.23 2013/04/03
# puma 2.0.1
# os: Linux 3.8-2-amd64 #1 SMP Debian 3.8.13-1 x86_64 GNU/Linux, also tested on OSX 10.8.3
$ haproxy -f haproxy.cfg
$ puma --port 3000 config.ru
$ ls /proc/PUMA_PID/fd -l | wc -l
# after some time, puma stops responding on port 3000
$ curl http://localhost:3000
class A
def set_foo(foo)
@foo = foo
end
def get_foo
@foo
end
def set_bar(bar)
require 'rubygems'
require 'hpricot'
require 'open-uri'
unless ARGV[0] and ARGV[1]
puts "Usage: ruby appleblogtv.rb url number_of_winners"
exit
end
commentators = []