Skip to content

Instantly share code, notes, and snippets.

View espadrine's full-sized avatar

Thaddée Tyl espadrine

View GitHub Profile
espadrine /
Created February 12, 2021 18:52
Birthday paradox on Slack username colors.

You might know the birthday problem: “it only takes 23 people so that two have the same birthday”.

But do you know the Slack username color problem?

Slack gives random colors to each user in compact view. But there’s only 51 colors to choose from, so as soon as you are 9 in a channel, odds are that two share the same color.

View gist:28faad538fb8aadec9fbbd361383b677
Tx74RVCgXiswTvD yeKGImuFXka2Y2x JKalxOHiQXtBEl7 qPCoctF82Th5Gpi
0lnxdLk5s0Tjzuk v4cuJ7BDnCjTCKq 6Xr2MZHgg6UyBLH zqZDdsfvbTLAC6D
CifYELzwhOiJaIA 8uXBbOLbUUhC4MD ox0043eX0QUhQbG zamauzRNZReGGDG
7hg8Hz4u226E7Ic bW4xOd900EAZRvN Mjs7629HFxl.
espadrine / OutputBigCrush
Last active April 19, 2020 13:03
Harmonoise PRNG
View OutputBigCrush
Starting BigCrush
Version: TestU01 1.2.3
Test smarsa_SerialOver calling smultin_MultinomialOver
espadrine /
Created January 1, 2019 12:30
Trying to use rr for debugging
$ rr record cargo test
rr: Saving execution to trace directory `/home/tyl/.local/share/rr/cargo-4'.
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running target/debug/deps/bench_insert-8cb017bd9e593f1f
running 5 tests
test tests::bench_insert_list ... ok
test tests::bench_insert_vec ... ok
test tests::test_insert_list ... ok
test tests::test_insert_tree_array ... FAILED
espadrine / new.js
Last active March 20, 2016 12:05
Potential new ScoutCamp API
View new.js
// Server demo. `node app [PORT [https]]`
// © 2011-2016 Thaddée Tyl, Jan Keromnes. LGPL.
let port = +process.argv[2] || +process.env.PORT || 1234
let camp = require('./lib/camp.js')
let sc = camp.start({port: port, secure: process.argv[3] === 'https'})
console.log('http://[::1]:' + port)
// Templating demo: /template.html?title=Hello&info=[Redacted].
espadrine / perl6.js
Created June 19, 2015 11:30
Perl6 CodeMirror syntax highlighting mode
View perl6.js
// Parts from Ace; see <>
CodeMirror.defineMode("perl6", function(cmCfg, modeCfg) {
// Fake define() function.
var moduleHolder = Object.create(null);
// Given a module path as a string, create the canonical version
// (no leading ./, no ending .js).
var canonicalPath = function(path) {
return path.replace(/\.\//, '').replace(/\.js$/, '');

Keybase proof

I hereby claim:

  • I am espadrine on github.
  • I am espadrine ( on keybase.
  • I have a public key whose fingerprint is 4AE5 032E 679C D54C 0AA1 6520 BF5F 9DA7 282E F842

To claim this, I am signing this object:

espadrine / watcher-no-dotfile.patch
Created October 30, 2014 15:31
Remove dot files from ember-cli sane watcher's reach
View watcher-no-dotfile.patch
--- node_modules/ember-cli/node_modules/broccoli-sane-watcher/index.js
+++ node_modules/ember-cli/node_modules/broccoli-sane-watcher/index.js
@@ -76,20 +76,19 @@
this.watched[dir] = watcher;
-Watcher.prototype.onFileChanged = function (filePath, root) {
- if (this.options.verbose) console.log('file changed', filePath);
- this.scheduleBuild(path.join(root, filePath));
espadrine / sync-stdin.js
Created September 12, 2014 11:32
How to read stdin synchronously in nodejs.
View sync-stdin.js
var fs = require('fs');
// Returns a buffer of the exact size of the input.
// When endByte is read, stop reading from stdin.
function getStdin(endByte) {
var BUFSIZE = 256;
var buf = new Buffer(BUFSIZE);
var totalBuf = new Buffer(BUFSIZE);
var totalBytesRead = 0;
var bytesRead = 0;
espadrine / argument.txt
Created September 9, 2014 23:54
View argument.txt
Arguably, in `page.inadequate.css`, this `.left` class should be `.block.left`, and `.right-on-hover` ought to be `.block.right-on-hover`, or something like that.
Still, creating name conflicts is a trap made hard to avoid.
Using namespaces eases the process. Classoids provide hierarchical classes. In this example, our rules related to `left` specifically on a `button` only apply on a `button` classoid; the `left` class does not apply to it. This avoids the name clashing.
(Unfortunately, CSS namespaces is already a thing, extended from XML namespaces, not what we want. I picked the term "classoid", because it is like a class.)
The example is contrived, but the problem is present. See also the last slides here <>.