Skip to content

Instantly share code, notes, and snippets.

@emauton
emauton / friends.py
Created July 28, 2019 13:36
Draw script for #coffee_friends on https://irishtechcommunity.com/
#!/usr/bin/env python3
# Draw script for #coffee_friends on https://irishtechcommunity.com/
# Produces a random draw of pairs from commandline args, using accompanying
# historical data in `pairs.txt` to minimize the number of times the same
# #coffee_friends meet.
import argparse
import itertools
@emauton
emauton / keybase.md
Created September 27, 2015 12:50
Keybase Github proof.

Keybase proof

I hereby claim:

  • I am emauton on github.
  • I am emauton (https://keybase.io/emauton) on keybase.
  • I have a public key whose fingerprint is B566 A230 245D 31DB 7FEB 556A 67F2 9854 B4AB 8F0F

To claim this, I am signing this object:

@emauton
emauton / gist:d33385c06e16b6446161
Created February 3, 2015 14:53
Trouble checking fuse_eqc at master branch, Erlang R16B02-basho5, QuickCheck 1.33.2
~/Source/fuse $ git branch -v
* master 32c6f79 Do not error on warnings for this project for now.
~/Source/fuse $ git diff | cat
diff --git a/eqc_test/fuse_eqc.erl b/eqc_test/fuse_eqc.erl
index 466a9a8..8dd3c3a 100644
--- a/eqc_test/fuse_eqc.erl
+++ b/eqc_test/fuse_eqc.erl
@@ -426,6 +426,7 @@ setup() ->
application:set_env(sasl, sasl_error_logger, false),
application:set_env(sasl, errlog_type, error),
@emauton
emauton / reverse_bench.erl
Created January 24, 2015 21:05
Microbenchmark timings for lists:reverse/1. Cf. http://jsfiddle.net/4fr5pzpy/1/
%% 1> reverse_bench:run().
%% [{10,0.17},
%% {100,0.47},
%% {1000,8.77},
%% {10000,90.72},
%% {100000,10446.0},
%% {1000000,10362.46},
%% {10000000,126800.38},
%% {100000000,36015715.28}]
-module(reverse_bench).
@emauton
emauton / jlouis-enacl-dialyzer-repro
Last active August 29, 2015 14:11
Reproduction of jlouis's Dialyzer crash from erlang-bugs 2014-12-16.
Per http://erlang.org/pipermail/erlang-bugs/2014-December/004714.html
$ uname -a && cat /etc/lsb-release
Linux chez-moi 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
$ KERL_CONFIGURE_OPTIONS="--enable-dirty-schedulers --disable-hipe" ./kerl build 17.4 erlang.17.4
...
--- /tmp/before.pmap 2014-09-29 20:22:49.065740687 +0100
+++ /tmp/after.pmap 2014-09-29 20:22:56.617740340 +0100
@@ -1,47 +1,46 @@
-2396: bash
+2464: bash
0000000000400000 900K r-x-- /bin/bash
00000000006e0000 4K r---- /bin/bash
00000000006e1000 36K rw--- /bin/bash
-00000000006ea000 24K rw--- [ anon ]
-000000000158c000 1588K rw--- [ anon ]
% 16:21 < badmatch> Is there any way to create binary of given length from
% string, i.e. <<Name:(12*8)>> when Name can be larger
% (cut it) or smaller (add trailing zeros) than 12 bytes?
% nox's solution on-channel
-module(badmatch_question).
-compile(export_all).
-spec binary_with_zero_pad(string(), non_neg_integer()) -> binary().
binary_with_zero_pad(Str, N) ->