Skip to content

Instantly share code, notes, and snippets.

View cheald's full-sized avatar

Chris Heald cheald

View GitHub Profile
acl purge {
"localhost";
"192.168.100.0"/24;
}
if ( req.request == "PURGE" ) {
if (!client.ip ~ purge) {
error 405 "Not allowed";
}
if ( req.http.x-purge ) {
#!/bin/bash
# Reload a varnish config
# Author: Kristian Lyngstol
FILE="/etc/varnish/yourconfig.vcl"
# Hostname and management port
# (defined in /etc/default/varnish or on startup)
HOSTPORT="localhost:6082"
NOW=`date +%s`
source 'http://rubygems.org'
platforms :mri_19 do
gem 'ruby-prof'
gem 'request_profiler'
gem 'debugger'
end
@font-face {
font-family: 'Mashicons';
src: font-url('mashicons-webfont.eot');
src: font-url('mashicons-webfont.eot?#iefix') format('embedded-opentype'),
font-url('mashicons-webfont.svg') format('svg'),
font-url('mashicons-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'icomoon';
src: font-url('icomoon.eot');
src: font-url('icomoon.eot?#iefix') format("embedded-opentype"),
font-url('icomoon.svg#icomoon') format("svg"),
font-url('icomoon.woff') format("woff"),
font-url('icomoon.ttf') format("truetype");
font-weight: normal;
font-style: normal;
}
% rvm use ruby-head
Using /usr/local/rvm/gems/ruby-head
chris@luna ~apache/repos git:(master*) ruby-head % gem install ruby-prof
Fetching: ruby-prof-0.11.2.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing ruby-prof:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-head/bin/ruby extconf.rb
checking for sys/times.h... yes
check process puppetmaster
with pidfile /var/run/puppet/unicorn.pid
start program "/bin/env unicorn -c /etc/puppet/unicorn.rb -E production /usr/share/puppet/ext/rack/files/config.ru -D"
stop program "/bin/kill `cat /var/run/puppet/unicorn.pid`"
scores = [
{id: 1, score: 5},
{id: 1, score: 10},
{id: 2, score: 3}
]
reduced = scores.inject({}) do |col, score|
(col[score[:id]] ||= []) << score
col
end.map {|k, v|
ASSET_HOSTS = ["https://da950294alksdjfa.cloudfront.net", "https://sa9dfasd0fa9sd.cloudfront.net"]
config.action_controller.asset_host = Proc.new {|source, request = nil, *_|
index = Digest::SHA1.digest(source)[0].ord % ASSET_HOSTS.length
ASSET_HOSTS[index]
}
% ab -n 10 -c 10 http://i0.wp.com/s.ma.tt/files/2012/06/DSC01205.jpg\?w\=3999
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking i0.wp.com (be patient).....done
Server Software: ECS
Server Hostname: i0.wp.com