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
/*
2D ARRAY
0 1 2 3 4 (x)
0 [ ][ ][ ][ ][ ]
1 [ ][ ][#][ ][ ]
2 [ ][ ][ ][ ][ ]
3 [ ][ ][ ][ ][ ]
4 [ ][ ][ ][ ][ ]
@binarymax
binarymax / keybase.md
Created March 19, 2015 22:37
keybase.md

Keybase proof

I hereby claim:

  • I am binarymax on github.
  • I am binarymax (https://keybase.io/binarymax) on keybase.
  • I have a public key whose fingerprint is F29D 3138 8A07 0E93 3EB1 0FF6 3231 DE37 8B23 41B5

To claim this, I am signing this object:

@binarymax
binarymax / GUID.js
Created April 5, 2015 20:05
8 char GUID
//Easy 8 char Base-36 GUID
var GUID = function() {
var char = function(){return Math.floor(Math.random()*36).toString('36')};
return char() + char() + char() + ((new Date())-0).toString('36').substr(3);
};
@binarymax
binarymax / TheListServeSolution.js
Created April 29, 2015 18:10
Solution to The ListServe puzzle
((function(f){"use strict";var bdy=window.top.document.body;bdy.innerHTML="";bdy.style.backgroundRepeat="repeat";var c=document.createElement("canvas");var d=c.getContext('2d');var e="";c.width=f;c.height=f;var g=d.createImageData(f,f);var h=[f*f];var i=[];var j=function(z){var a=g.data;for(var x=0;x<f;x++){for(var y=0;y<f;y++){var b=(x+y*f)*4;a[b+0]=(h[b].r*z)%255;a[b+1]=(h[b].g*z)%255;a[b+2]=(h[b].b*z)%255;a[b+3]=255}}d.putImageData(g,0,0);e=c.toDataURL();i.push('url('+e+')')};var k=0,dir=1;var l=function(){bdy.style.backgroundImage=i[k];k+=dir;if(k===f)dir=-1;if(k===0)dir=1};for(var x=0;x<f;x++){for(var y=0;y<f;y++){var m=(x+y*f)*4;h[m]={r:parseInt((x^y)),g:parseInt((x|y)),b:parseInt((x&y))}}}for(var z=0;z<f;z++){j(z)}setInterval(l,200)})(300))
Starting training using file 10m.txt
Vocab size: 305432
Words in train file: 565170189
Alpha: 0.000045 Progress: 99.91% Words/thread/sec: 107.57k
real 174m19.955s
user 1315m35.661s
sys 3m27.011s
---------------------------
@binarymax
binarymax / LICENSE.txt
Created May 22, 2011 23:08 — forked from 140bytes/LICENSE.txt
Javascript Performance Timer
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 27, 2011 15:21 — forked from 140bytes/LICENSE.txt
Binary Search
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Max Lovenheim Irwin <http://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
@binarymax
binarymax / LICENSE.txt
Created September 4, 2011 20:47 — forked from 140bytes/LICENSE.txt
isSubset
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
@binarymax
binarymax / triangula.js
Created September 8, 2011 19:28
triangula
jj.createCreature('triangula', function (layer) {
var canvas = document.createElement('canvas'),
context = canvas.getContext('2d'),
twidth = 75,
theight = 75,
width = canvas.width = 100,
height = canvas.height = 100,
world = jj.size(),
imgd = context.createImageData(twidth,theight),
@binarymax
binarymax / fib_scale.js
Created December 30, 2011 14:53
Scales the fibonacci sequence
#!/usr/bin/env node
(function() {
var rnd = function(x) { return Math.round(x*10)/10; };
var tbl = function(a) {
var b=[];
for(var i=0,l=a.length;i<l;i++) {
var n=a[i].toString();
for(var j=0, s=" "; j<(5-n.length);j++) {