Skip to content

Instantly share code, notes, and snippets.

View binarymax's full-sized avatar
👻
for(;1;){work();eat();rest();}

Max Irwin binarymax

👻
for(;1;){work();eat();rest();}
View GitHub Profile
@binarymax
binarymax / CraftyChess.txt
Last active November 29, 2015 22:00
Compile Crafty Chess on Mac OSX
Compiling crafty chess on MacOS, you get the following error:
-------------------------------------------------------------
~/apps/crafty/crafty-23.4:$ make darwin
/Applications/Xcode.app/Contents/Developer/usr/bin/make target=FreeBSD \
CC=gcc CXX=g++ \
CFLAGS='-Wall -pipe -O3' \
CXFLAGS='-Wall -pipe -O3' \
LDFLAGS= \
LIBS='-lstdc++' \
opt='' \
@binarymax
binarymax / gist:5039967
Created February 26, 2013 16:41
Workaround for toDataURL >2MB
//From https://code.google.com/p/chromium/issues/detail?id=69227#c37
//take apart data URL
var parts = canvas.toDataURL().match(/data:([^;]*)(;base64)?,([0-9A-Za-z+/]+)/);
//assume base64 encoding
var binStr = atob(parts[3]);
//convert to binary in ArrayBuffer
var buf = new ArrayBuffer(binStr.length);
@binarymax
binarymax / elosim.js
Last active December 24, 2015 19:59
Elo rating simulation
/*********************************
*
* Elo Rating Simulation
* Copyright (c) 2013, Max Irwin
* MIT License
*
*********************************/
(function(){
var players = [];
@binarymax
binarymax / word2vec_hn_classifications_1.txt
Created March 19, 2016 13:32
word2vec hn classifications
startups(0.265) | Previously: https://news.ycombinator.com/item?id=9990221
religion(0.227) | Out of curiosity, why secular humanism vs existential nihilism? I don't think I'll switch sides and time soon, but if I did it would be to nihilism.
education(0.245) | Education and Healthcare: Two services which should not be offered by businesses seeking to make a profit. I think future generations will look back and ask: "What were they thinking?"
religion(0.203) | Also if the opposite sex thinks you're gay but you're straight, it's harder to attract them.
@binarymax
binarymax / hn2vec.js
Last active May 22, 2016 08:59
Parses news.ycombinator.com comment archive into word2vec digestable format.
#!/usr/bin/env node
var linestream = require('line-stream');
var htmldecode = require('htmldec');
var s = linestream();
var numbers = "zero,one,two,three,four,five,six,seven,eight,nine".split(',');
var reletter = /[a-z_]/i;
var renumber = /[0-9]/;
var reclose = /\<\/[^\>]+\>/g;
@binarymax
binarymax / LICENSE.txt
Created May 22, 2011 17:27 — forked from 140bytes/LICENSE.txt
Powerset from array
Copyright (c) 2011 Max Lovenheim Irwin, http://binarymax.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@binarymax
binarymax / LICENSE.txt
Created May 22, 2011 22:35 — forked from 140bytes/LICENSE.txt
Statistical variance
Copyright (c) 2011 Max Lovenheim Irwin, http://binarymax.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@binarymax
binarymax / getComputedColor.js
Created August 6, 2016 09:34
Use getComputedStyle to get an RGBA value from any supported CSS color.
(function(){
var getColor = function(c) {
var temp = document.createElement("div");
var color = {r:0,g:0,b:0,a:0};
temp.style.color = c;
temp.style.display = "none";
document.body.appendChild(temp);
var style = window.getComputedStyle(temp,null).color;
document.body.removeChild(temp);
@binarymax
binarymax / md2html.js
Created August 7, 2016 11:23
Use commonmark to generate html from a list of markdown files
#!/usr/bin/env node
var fs = require('fs');
var cm = require('commonmark');
var convert = function(markdown) {
var reader = new cm.Parser();
var writer = new cm.HtmlRenderer();
var parsed = reader.parse(markdown);
var result = writer.render(parsed);
return result;
@binarymax
binarymax / LICENSE.txt
Created December 9, 2011 11:31 — forked from 140bytes/LICENSE.txt
SortedSet
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Max Irwin http://www.binarymax.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE