Skip to content

Instantly share code, notes, and snippets.

View xandkar's full-sized avatar
🤔
quis custodiet ipsos custodes?

Siraaj Khandkar xandkar

🤔
quis custodiet ipsos custodes?
View GitHub Profile
@xandkar
xandkar / exh.ml
Created July 1, 2014 17:01 — forked from NicolasT/exh.ml
(* This works *)
module W = struct
type a
type b
type (_, _) t =
| AA : (a, a) t
| AB : (a, b) t
| BB : (b, b) t
run_simulation = function(router_mode = "naive",
reqs_per_minute = 9000,
simulation_length_in_minutes = 5,
dyno_count = 100,
choice_of_two = FALSE,
power_of_two = FALSE,
unicorn_workers_per_dyno = 0,
track_dyno_queues = FALSE) {
if(!(router_mode %in% c("naive", "intelligent"))) {
# 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,
rq = read.table("~/Downloads/request_times.txt", header=FALSE)$V1
run_simulation = function(router_mode = "naive", reqs_per_minute = 9000, simulation_length_in_minutes = 5, dyno_count = 100) {
if(!(router_mode %in% c("naive", "intelligent"))) {
return("router_mode must be one of 'naive' or 'intelligent'")
}
reqs_per_ms = reqs_per_minute / 60000
simulation_length_in_ms = simulation_length_in_minutes * 60000
@xandkar
xandkar / build-erlang-r15b.sh
Created July 13, 2012 21:37 — forked from bryanhunter/build-erlang-r15b.sh
Build Erlang R15B on a fresh Ubuntu box (tested on Ubuntu 11.10)
#!/bin/bash
# Pull this file dowm, make it executable and run it with sudo
# wget https://raw.github.com/gist/1603037/build-erlang-r15b.sh
# chmod u+x build-erlang-r15b.sh
# sudo ./build-erlang-r15b.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi