Skip to content

Instantly share code, notes, and snippets.

@bemasher
bemasher / doc-detect.py
Created March 7, 2022 22:20
Given an image of a scanned greyscale document with overscan borders, crop and threshold to just the document.
import pathlib
import cv2 as cv
import numpy as np
from skimage.measure import LineModelND, ransac
srcPath = pathlib.Path('input')
dstPath = pathlib.Path('output')
k = cv.getStructuringElement(cv.MORPH_CROSS, (3, 3))
@bemasher
bemasher / md_link.go
Created September 30, 2020 05:26
Walks a directory and lists links and text for markdown files.
package offline
import (
"io"
"log"
"math/rand"
"os"
"testing"
"time"
@bemasher
bemasher / README.md
Last active February 2, 2019 21:19
This has become a full-blown project, see https://github.com/bemasher/rtlamr-collect
@bemasher
bemasher / cq.sql
Last active October 30, 2016 10:43
CREATE CONTINUOUS QUERY cq_five_years_home ON rtlamr BEGIN
SELECT min(*), mean(*), max(*)
INTO rtlamr.five_years.home
FROM rtlamr.three_days.home
GROUP BY time(1d), "name"
END
@bemasher
bemasher / PKGBUILD
Created March 25, 2016 02:45
AUR intel-opencl-sdk for 2016_6.0.0.1049
# Maintainer: Daniel Nagy <danielnagy at gmx de>
# Contributor: Nicolas Bigaouette <nbigaouette@gmail.com>
# Contributor: Vojtech "kralyk" Kral
# Contributor: Douglas Hall <bemasher@gmail.com>
pkgname='intel-opencl-sdk'
pkgver=2016_6.0.0.1049
pkgrel=0
pkgdesc="Intel’s implementation of the OpenCL standard optimized for Intel processors."
arch=('x86_64')
$ go get -u -v github.com/bemasher/rtlamr
github.com\bemasher\rtlamr (download)
github.com\bemasher\rtltcp (download)
github.com/bemasher/rtlamr
package contains
import (
"regexp"
"strings"
)
func ContainsToUpper(s, substr string) bool {
return strings.Contains(strings.ToUpper(s), strings.ToUpper(substr))
uniform int iterations;
uniform vec2 scale, seed;
#define PI 3.14159265358979323846
void main(void) {
vec2 z =(gl_TexCoord[0].xy - 0.5) * scale;
int i = 1;
for(; dot(z, z) <= 4.0 && i < iterations; i++) {
z = vec2(z.x * z.x - z.y * z.y, (z.x + z.x) * z.y) + seed;
@bemasher
bemasher / dft12.alst
Created September 25, 2014 19:44
Parser for Annotated expressions generated by FFTW's genfft tool.
(:= T1 xi[0])
(:= T6 xi[6])
(:= T2 xi[4])
(:= T3 xi[8])
(:= T4 (+ T2 T3))
(:= T32 (+ T3 (- T2)))
(:= T7 xi[10])
(:= T8 xi[2])
(:= T9 (+ T7 T8))
(:= T33 (+ T8 (- T7)))