Skip to content

Instantly share code, notes, and snippets.

@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
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
# 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,
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"))) {
@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
@xandkar
xandkar / springer-free-maths-books.md
Created December 29, 2015 13:18 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of books available for free, here are the direct links
#!/bin/bash
W=`xdotool getactivewindow`
S1=`xprop -id ${W} |awk -F '"' '/WM_CLASS/{print $4}'`
echo "$S1" >> /tmp/log.txt
if [ "$S1" = "Firefox" ]; then
xdotool keydown --window ${W} Ctrl+t
fi
@xandkar
xandkar / notes.md
Created March 17, 2018 20:14 — forked from aerosol/notes.md
The Year Of Linux Desktop

PC

  • LG 27UD69P-4k
    • expecting 2.0 1080p worst case
  • Crystal Series case 570X RGB
  • Silent Loop 360 water cooler
  • 750W Straight Power 11
  • Ryzen Threadripper 1920X
  • X399 Aorus Gaming 7 mobo
  • 16GB 3000MHz XPG Dazzle CL16
@xandkar
xandkar / systemd.erl
Created July 27, 2018 17:09 — forked from maxlapshin/systemd.erl
Systemd support
-module(systemd).
% This is what you need to adopt systemd in erlang
%
% Do whatever you want license. If you want, you can take this code under terms of MIT license.
-export([ready/0, reloading/0, stopping/0, watchdog/0]).
-export([start_link/0]).
-export([init/1, handle_info/2, terminate/2]).
@xandkar
xandkar / init.c
Created January 17, 2019 20:15 — forked from rofl0r/init.c
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;