Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include <math.h>
static uint8_t reference[256][256] = {
#include "reference.h"
};
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>dataview test</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@pdewacht
pdewacht / cover.py
Created January 20, 2019 20:14
Book cover test
import cv2 as cv
import numpy as np
import os.path
import sys
def is_useful_cover(f):
# intended for thumbnail images, width = 180 pixels
img = cv.imread(f)
img = cv.Canny(img, 100, 200)
#!/usr/bin/env python3
import re, sys
from heapq import heapify, heappush, heappop
class Bot:
def __init__(self, x, y, z, r):
self.x = x
self.y = y
self.z = z
self.r = r
#!/usr/bin/python3
import Levenshtein
import sys
def read_wordlist(f):
return set(w.strip().lower() for w in f)
wordlist = read_wordlist(sys.stdin)
# filter out non-words, brand names, and regional spellings
wordlist = wordlist.intersection(read_wordlist(open('/usr/share/dict/american-english')))
@pdewacht
pdewacht / rc4-not-tiny-enough.py
Created October 22, 2014 20:45
RC4 in 170 bytes
def rc4(K):
B=256;S=range(B);b=c=d=0
for a in S[:]:b=(b+S[a]+K[a%len(K)])%B;S[a],S[b]=S[b],S[a]
while 1:c=(c+1)%B;d=(d+S[c])%B;a,b=S[c],S[d]=S[d],S[c];yield S[(a+b)%B]