Skip to content

Instantly share code, notes, and snippets.

View zeeshanlakhani's full-sized avatar

Zeeshan Lakhani zeeshanlakhani

View GitHub Profile
@zeeshanlakhani
zeeshanlakhani / face-bounding-box.py
Created December 13, 2012 15:27
face-detection ~ visual-mean (no cropping approach in this file, just detection)
import os, sys, glob
import cv
import math
import argparse
HAAR_CASCADE_FRONT = \
"/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml"
HAAR_CASCADE_PROFILE = \
"/usr/local/share/OpenCV/haarcascades/haarcascade_profileface.xml"
/**
* Creates an ArrayBuffer, converts the binary to a Uint8 Array, and
* places the buffer in a DataView, which is needed to create a Blob
**/
_makeBlob: function(binary) {
var data = new ArrayBuffer(binary.length),
mimeString = "text/plain",
ui8a = new Uint8Array(data, 0),
dataView,
blob;
(ns markerbot.core
(:require [taoensso.timbre :as log]
[clojure.data.json :as json]
[clojure.string :as s]
[clj-http.client :as client])
(:import (java.net Socket)
(java.io PrintWriter InputStreamReader BufferedReader))
(:gen-class))
;; marksy
# time
# ====
macro time(ex)
quote
local t0 = time_ns()
local val = $(esc(ex))
local t1 = time_ns()
println("elapsed time: ", (t1-t0)/1e9, " seconds")
val
four primitives: run*, ==, conde, fresh
(run* (q)
(== q #t))
; for what values of q is q equal to true?
answer: q must also be #t, so
'(#t) ; answer comes back in a list
USING: kernel math sequences ;
IN: euler1
: multiple-of ( x y -- z ) mod zero? ;
: euler1 ( x -- y )
1 - iota [ 1 + ] map
[ dup [ 3 multiple-of ] [ 5 multiple-of ] bi or [ ] [ drop 0 ] if ]
map
sum

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

Keybase proof

I hereby claim:

  • I am zeeshanlakhani on github.
  • I am zeeshanlakhani (https://keybase.io/zeeshanlakhani) on keybase.
  • I have a public key whose fingerprint is 1AC6 B34F BA77 A396 AB72 6F85 5D47 A705 052B 85B3

To claim this, I am signing this object:

@zeeshanlakhani
zeeshanlakhani / eqc_statem.md
Created July 13, 2015 18:26
Andrew Stone's Great eqc_statem notes

Testing Stateful Code

So far, all the properties we have written have tested stateless code. Stateless code is made up of pure functions and is inherently easier to test than stateful code with side effects. The chief problem with testing stateful code is that the input to output mapping depends on the current state of the program. Previous operations can cause the same function to return different output given the same input. Therefore, in order to test stateful code, our tests must maintain some state of their own. This state is known as the model state and is updated as part of the testing process.