Skip to content

Instantly share code, notes, and snippets.

View blt's full-sized avatar

Brian L. Troutwine blt

View GitHub Profile
@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():
#![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())
@blt
blt / Q.lhs
Created August 14, 2015 16:45
> module Q where
I have a situtation where it would be extremely useful to limit
the self-recursion of a data type to only a subset of its
constructors. Consider the datatype T below:
> data T
> = A integer
> | B T float
> | C T [float]
@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.").
html {
font-family: 'Monaco';
font-size: 9pt;
background-color: #000;
color: #f0f0f0;
}
body {}
.url { color: #99cf50; }
.address {}
-module(udp_srv).
-export([go/1]).
%%%===================================================================
%%% API
%%%===================================================================
go(Port) ->
{ok, Socket} = gen_udp:open(Port, [binary,{active,false}]),
(walden-2) ~/projects/com/github/jiffy
blt> rm -rf _build/ && DEBUG=1 rebar3 pc clean, pc compile
===> Evaluating config script "rebar.config.script"
===> Consult config file "rebar.lock"
===> error function_clause
===> Plugin rebar_gdb_plugin not available. It will not be used.
===> Consult config file "/Users/blt/projects/com/github/jiffy/_build/default/plugins/pc/rebar.config"
===> Consult config file "/Users/blt/projects/com/github/jiffy/_build/default/plugins/pc/rebar.lock"
===> Fetching pc ({git,"file:///Users/blt/projects/us/troutwine/port_compiler",