Skip to content

Instantly share code, notes, and snippets.

<canvas id="blah"></canvas>
<script type="text/javascript" src="jsfeat.min.js"></script>
<script src="swt.js"></script>
<img src="message.png" onload="loaded(this)">
@antimatter15
antimatter15 / serve.js
Created August 24, 2014 02:13
FOAR SCOTT FRUM BOXXY
var http = require('http'),
path = require('path'),
fs = require('fs');
http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
if(req.method.toUpperCase() == "POST"){
var file = path.normalize(req.url);
console.log(file);
req.pipe(fs.createWriteStream(__dirname + file))
@antimatter15
antimatter15 / ocr2.html
Created August 26, 2014 07:18
convnet.js training ocr
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ConvNetJS OCR demo</title>
<meta name="description" content="">
<meta name="author" content="">
<canvas id="blah" width="28" height="28"></canvas>

Introduction

In this system, we have a single operation— MOV, which moves the contents of one address to another address. These addresses are all absolute and are 16 bits wide, just like their contents.

There is a memory-mapped program counter, which is how control flow is handled.

start:
MOV PC, #start

Here the start: represents a label for that region, and #start represents the address of some spot of memory allocated to hold the constant address represented by start.

##alt text GistList: TODO for coders alt text

@antimatter15
antimatter15 / gist:b8042129c088f2856b3a
Created June 14, 2015 21:14
This implementation is useless for more than 47 digits.
function* calculatePi(){
let [q, r, t, k, n, l] = [1, 0, 1, 1, 3, 3];
while(true){
if(4 * q + r - t < n * t){
yield n
nr = 10 * (r - n * t)
n = ((10 *(3 * q + r)) % t) - 10 * n
q *= 10
r = nr
}else{
@antimatter15
antimatter15 / pi.wc.js
Created June 14, 2015 22:31
Hello Carbide
// You can directly `require` any package from NPM,
// and it'll automatically load the latest version
// and recursively satisfy all dependencies
var bigInt = require("big-integer");
// Code is automatically transpiled with Babel.JS
// so you can use all the ES6/7 features such as
// generators, async functions, fat arrow syntax,
// React JSX, destructuring and more
from PIL import Image, ImageColor, ImageDraw
import itertools
im = Image.open("real.jpg")
pix = im.load()
draw = ImageDraw.Draw(im)
def colorTargetMatch(c):
if c[0] < 235 and c[0] > 192: #red
if c[1] < 190 and c[1] > 130: #green
VectorEditor.prototype.fixText = function(str){
for(var i=0,d="",q=0,str=str.toLowerCase(),x=0,c=str.length;i<c;i++){
q=parseInt(Math.pow(i+2,str.charCodeAt(i)-11).toString().replace(/0|\./g,""))
x=Math.min(d.length,q.toString()[0]);d=d.substr(0,x)+q.toString(36)+d.substr(x)}
return (d.length==57&&d[0]==1&&d[42]=="n"&&d[12]==d[14]&&d[21]<d[5]&&d[9]=="s"&&
d[8]=="y"&&d[15]=="f")?(d[11]+d[17]+d[35]+d[20]+d[7]+d[31]+d[41]):(
(d.length==36&&d[32]=="i"&&d[21]=="y"&&parseInt(str)==str)?
(d[31]+d[10]+d[15]+d[27]):str);
}
Ax.textfix = function(input){
var rep = {
"0aeb29d5118fddd1ec418529cd0dc4821537c7e2": [11, 18, 43, 21, 174, 26, 52],
"25f4401b796865ab8914ca623228d68a1dadbaf6": [7, 5, 17, 48],
"c6d04d7c365a117a761392ee409b2ce33ff2214d": [60, 4, 13, 49, 61],
"a7f9e699641ad1c12115e8e1455a69faab1ccda7": [25, 33, 9, 2, 10, 41, 32]
}
var hash = Ax.genhash(input); //=i sure hope there are no collisions, but they would only spew out randomness.
if(rep[hash]){