THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
// DSL for producing distributions of dice rolls | |
type Cont<T> = (state: T) => void; | |
const rollDie = <T, U>(faces: number, state: T, cont: (faces: number, state: T, next: Cont<U>) => void, next: Cont<U>) => { | |
for (let i = 1; i <= faces; i++) { | |
//console.log(state, 'rolled', i); | |
cont(i, { ...state }, next); | |
} | |
}; |
find_package(Threads REQUIRED) | |
ExternalProject_Add( | |
googletest | |
GIT_REPOSITORY https://github.com/google/googletest.git | |
UPDATE_COMMAND "" | |
INSTALL_COMMAND "" | |
LOG_DOWNLOAD ON | |
LOG_CONFIGURE ON | |
LOG_BUILD ON) |
#!/usr/bin/env ruby | |
require 'ipaddr' | |
require 'pcaprub' | |
require 'strscan' | |
# https://en.wikipedia.org/wiki/EtherType | |
ETHER_TYPE = { | |
0x0800 => :ipv4, | |
0x0806 => :arp, |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
#!/usr/bin/env bash | |
# HubCrypt | |
# ======== | |
# | |
# Decrypt a file encrypted using hubencrypt (ok, it's just openssl + rsautl + | |
# your SSH keys). It needs the private key that matches your last public key | |
# listed at github.com/<user>.keys | |
# |
# sets the proxy cache path location, max size 2g | |
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g; | |
# transfers the `Host` header to the backend | |
proxy_set_header Host $host; | |
# uses the defined STATIC cache zone | |
proxy_cache STATIC; | |
# cache 200 10 minutes, 404 1 minute, others status codes not cached |
// -*- compile-command: "clang++ -ggdb -o random_selection -std=c++0x -stdlib=libc++ random_selection.cpp" -*- | |
//Reference implementation for doing random number selection from a container. | |
//Kept for posterity and because I made a surprising number of subtle mistakes on my first attempt. | |
#include <random> | |
#include <iterator> | |
template <typename RandomGenerator = std::default_random_engine> | |
struct random_selector | |
{ | |
//On most platforms, you probably want to use std::random_device("/dev/urandom")() |
I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.
Imagine a long-running development branch periodically merges from master. The
git log --graph --all --topo-order
is not as simple as it could be, as of git version 1.7.10.4.
It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.