Skip to content

Instantly share code, notes, and snippets.

View blt's full-sized avatar

Brian L. Troutwine blt

View GitHub Profile
@blt
blt / hello.erl
Last active December 4, 2020 05:41
What should be the standard Erlang "Hello, world!"
-module(hello).
-export([hello/1]).
hello(robert) ->
io:format("Hello, Mike.");
hello(joe) ->
io:format("Hello, Robert.");
hello(mike) ->
io:format("Hello, Joe.").
@blt
blt / .gitignore
Last active September 29, 2018 22:00
cov experiment
*.o
*.a
example_cc
example_rs

Keybase proof

I hereby claim:

  • I am blt on github.
  • I am troutwine (https://keybase.io/troutwine) on keybase.
  • I have a public key ASA7ED3F_HArLA08CgrbzXJqASlFHbPd8ilNmvM49OS7DQo

To claim this, I am signing this object:

#!/usr/bin/env python2.7
import time
import socket
import sys
def graphite_metric(sock, name, value):
timestamp = int(time.time())
sock.send("%s %f %d\n" % (name, value, timestamp))
def main():
case object transaction {
import java.sql.Connection
def apply[T](query: => T):Option[T] = {
val conn:Connection = play.db.DB.getConnection
val auto:Boolean = conn.getAutoCommit
try {
conn.setAutoCommit(false)
Some(query)
} catch {
/*
* 2012 -- updated to make use of an 8-core machine by Brian L. Troutwine
*
* THC/2003
*
* Simple ssh-private key cracker. Tries to brute force (dictionary
* attack) almost any ssh private key file format.
*
* This is just a quick tool from THC. Using OpenSSL is not really
* fast...
@blt
blt / book_list.md
Last active December 24, 2016 08:42
A list of my favorite books, in no particular order and with no particular applicability in mind.

A List of my Favorite Books

I've categorized the books--roughly--by Big Theme: the header to each sub-list.

The Idea of America

  • "Debate on the Constitution, Vol. I and II", various (Library of America)
  • "The Praire Traveler", Randolph B. Marcy
  • "An American Tragedy", Theodore Dreiser
  • "The Great Gatsby", F. Scott Fitzgerald
#![cfg_attr(test, feature(plugin))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#![allow(dead_code)]
#![allow(unused_imports)]
#[cfg(test)]
extern crate quickcheck;
/// This is an implementation of the algorithm presented in Cormode, Korn,
#![cfg_attr(test, feature(plugin))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#[cfg(test)]
extern crate quickcheck;
fn reverse<T: Clone>(xs: &[T]) -> Vec<T> {
let mut rev = vec!();
for x in xs {
rev.insert(0, x.clone())

Lunar Base Airlock Problem

Your goal is to design a control-system for a lunar base, this one:

Overview

In particular, we're going to focus on the airlock system, consisting of three doors A, B and C. Each internal segment AB and BC may be variably pressurized.

Airlock Detail