This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# you can make a text file of request times (in ms, one number per line) and import it here, or you can use a probability distribution to simulate request times (see below where setting req_durations_in_ms) | |
# rq = read.table("~/Downloads/request_times.txt", header=FALSE)$V1 | |
# argument notes: | |
# parallel_router_count is only relevant if router_mode is set to "intelligent" | |
# choice_of_two, power_of_two, and unicorn_workers_per_dyno are only relevant if router_mode is set to "naive" | |
# you can only select one of choice_of_two, power_of_two, and unicorn_workers_per_dyno | |
run_simulation = function(router_mode = "naive", | |
reqs_per_minute = 9000, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
amazon_sender.py | |
~~~~~~~~ | |
Python helper class that can send emails using Amazon SES and boto. | |
The biggest feature of this class is that encodings are handled properly. | |
It can send both text and html emails. | |
This implementation is using Python's standard library (which opens up for a lot more options). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'chef/encrypted_data_bag_item' | |
secret = Chef::EncryptedDataBagItem.load_secret('data_bag_key') | |
data = {"id" => "mysql", "root" => "some secret password"} | |
encrypted_data = Chef::EncryptedDataBagItem.encrypt_data_bag_item(data, secret) | |
FileUtils.mkpath('data_bags/passwords') | |
File.open('data_bags/passwords/mysql.json', 'w') do |f| | |
f.print encrypted_data.to_json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Default (OS X).sublime-keymap */ | |
/* Key Bindings - User */ | |
[ | |
{ "keys": ["ctrl+shift+."], "command": "erb" }, | |
{ "keys": ["super+shift+t"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, | |
{ "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" }, | |
// swap normal paste and paste-with-indention | |
{ "keys": ["super+v"], "command": "paste_and_indent" }, | |
{ "keys": ["super+shift+v"], "command": "paste" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :assets do | |
task :rebuild do | |
# Config the base names of all the jammit CSS packages you have defined | |
# in assets.yml. Could probably parse assets.yml to get this if | |
# we wanted to. | |
packages = ['common'] | |
# This is because on OS X, you have to put an explicit empty string to the | |
# required extension argument with the -i parameter, but on Linux you | |
# do not. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set cache dir | |
proxy_cache_path /var/cache/nginx levels=1:2 | |
keys_zone=microcache:5m max_size=1000m; | |
# Virtualhost/server configuration | |
server { | |
listen 80; | |
server_name yourhost.domain.com; | |
# Define cached location (may not be whole site) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant::Config.run do |config| | |
# ... | |
config.vm.customize do |vm| | |
# Use the host resolver for DNS so that VPN continues | |
# to work within the VM | |
vm.network_adapters.each do |na| | |
if na.enabled? && na.nat_driver | |
na.nat_driver.dns_use_host_resolver = true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package 'debootstrap' | |
package 'apt-cacher-ng' | |
package 'inotify-tools' | |
include_recipe 'lxc::manage' | |
include_recipe 'lxc::network_bridge' | |
include_recipe 'lxc::dns' | |
host = node[:container] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% | |
%% Generic riak_pipe_vnode_worker worker, so you can write multiple fittings in one file. | |
%% | |
%% Each fitting is a function which must accept | |
%% | |
%% ImplFun(init, InitArg) -> {ok, State} | |
%% ImplFun({process, Input}, State) -> {ok, State} | forward_preflist | |
%% ImplFun(done, State) -> ok | |
%% | |
%% gen_pipe also has some more friendly API |