Skip to content

Instantly share code, notes, and snippets.

mrallen1 /
Last active Apr 27, 2021
thai peanut crispy fried tofu on zoodles

Thai peanut sauce crispy tofu over zucchini noodles

  • 1 pkg extra firm tofu
  • 1 T olive oil
  • 1/4 c peanut butter
  • 2 T tamari
  • 1 1/2 T rice wine vinegar
  • 1 t minced garlic
  • 1 t minced ginger
mrallen1 / ss.erl
Created Aug 21, 2019
Self Stabilizing Systems in Spite of Distributed Control
View ss.erl
%% @doc
%% This Erlang module implements the ideas illustrated in Edsger Dijkstra's
%% famous paper "Self Stabilizing Systems in Spite of Distributed Control"
%% @end
-export([stop/1, show/1, start/1]).
-define(DELAY, 1000).
-define(THRESHOLD, 0.90).
mrallen1 /
Created Aug 1, 2018
Russian personal pronouns
#!/usr/bin/env perl
use 5.014;
use utf8;
use Text::CSV qw(csv);
use List::Util qw(shuffle pairs);
use List::MoreUtils qw(zip);
my $pn = {
mrallen1 /
Last active Jan 4, 2018
Using references in jesse for JSON schema validation

If you use the [jesse][1] application for JSON schema validation, you will no doubt be mystified by the byzantine way that references are handled in the application. I spent well over 30 hours trying to figure it out, since it is totally undocumented what the format should be.

I tried to make things as simple as possible. I had a file with the "base" schema for an item. I called it record.json It looked something like this:

   "id": "record",
   "description": "Base schema for a valid record",
   "type": "object",
mrallen1 /
Created Dec 12, 2017
Developing on SurfaceBook 2

I recently made the switch back to Windows 10 after spending 15 years using a Mac as my personal laptop. I won't go into all of the rationale behind that decision but the most succinct answer is that I have felt like Apple's doing me a favor by buying their products, not the other way around for the past three releases of macOS. As a rather committed vi partisan, removing the ESC key from the high end Mac Book Pros was kind of the final straw.

In any case, I bought my Surface Book 2 about two weeks ago. This past weekend, I took part in [Spawnfest][1], a 48 hour programming contest aimed at Erlang/Elixir. I wrote all of the code on the Surface Book 2 and I know some people are interested in my experience.

So keeping with the usual trite cliches, I'll use the "Good", "Bad" and "Ugly."


  • Windows Subsystem for Linux was flawless during my work. I used it exclusively to develop code. Git and Erlang and every other tool I needed Just Worked, and worked well.
mrallen1 / rebar3_hex_v2_resources.erl
Last active Mar 17, 2018
Using hex v2 resources in Erlang
View rebar3_hex_v2_resources.erl
%% A strawman implementation to kick around
%% needs application:ensure_all_started(public_key).
mrallen1 /
Last active Aug 21, 2017
Playing Expedition RPG card game with my kids

Playing Expedition RPG card game with my kids

I spent a few hours playing [Expedition RPG card game][1] with my kids today and I wanted to write up something longer than a tweet to share our experience. If you haven't heard of Expedition, it's along the lines of a more-or-less standard "fantasy" world with fantastic creatures and hardy adventurers, but without so many rules in in it. The mechanics for combat are very lightweight -- more like a LARP type system, but even more streamlined. The pretty cool "twist" to this is the use of a phone app (the app is available for both iOS and Android) to help mediate some of the storytelling and combat.

Players each get an adventurer card which lays out a very barebones personality ("hungry chef", "dutiful soldier", "fretful bard", etc) and six abilities in Magic, Music, Melee or Ranged. Each adventurer has 12 health points. These abilites are part of four decks of cards which are shuffled and dealt out. Depending on t

mrallen1 / ringbuffer.erl
Last active Aug 2, 2017
ringbuffer interface using a normal Erlang list
View ringbuffer.erl
mrallen1 / ngram.erl
Created Jun 26, 2017
ngram builder for Erlang
View ngram.erl
ngram(N, Str) ->
make_ngram(N, Str, 1, orddict:new()).
make_ngram(_N, Str, Pos, Acc) when Pos >= length(Str) -> Acc;
make_ngram(N, Str, Pos, Acc) ->
make_ngram(N, Str, Pos+1, orddict:update_counter(lists:sublist(Str, Pos, N), 1, Acc)).
mrallen1 /
Last active Jun 10, 2021
Building Erlang on WSL/Ubuntu 16.04(LTS)

Building Erlang on Windows Subsystem for Linux (WSL)

WSL Overview

WSL is a driver shim for Windows 10 that enables you to run native Linux code on Windows without recompiling or running a Docker/VM. It currently supports Ubuntu 16.04 LTS - but more distribution support has been announced.

Building Erlang

From a "clean" install of Ubuntu such as the kind you would get from a fresh install of WSL, you need to preinstall these debs to enable kerl to compile a working Erlang: