This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 207a4c622081c32ebcb25ce0825e6c7704f81ac0 Mon Sep 17 00:00:00 2001 | |
From: Vedant Kumar <vk@vedantk.com> | |
Date: Mon, 30 May 2011 16:37:55 -0400 | |
Subject: [PATCH] Added compat headers, removed hacky cvSumPixels workaround | |
--- | |
MLDemos/public.h | 9 ++++----- | |
MLDemos/sampleManager.cpp | 4 ++-- | |
MLDemos_variables.pri | 3 +-- | |
3 files changed, 7 insertions(+), 9 deletions(-) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (f n) | |
(if (< n 3) | |
n | |
(+ (f (- n 1)) | |
(* 2 (f (- n 2))) | |
(* 3 (f (- n 3)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (f' n) | |
(define (f'-iter a b c count) | |
; f(n) = a + b + c = f(n-1) + 2f(n-2) + 3f(n-3). | |
; Use f(n) to calculate f(n+1) = f(n) + 2f(n-1) + 3f(n-2). | |
(if (= count (+ n 1)) | |
a | |
(f'-iter (+ a b c) (* 2 a) (* 3 (/ b 2)) (+ count 1)))) | |
(if (< n 3) | |
n | |
; f(3) = f(2) + 2f(1) + 3f(0). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Vedant Kumar <vsk@berkeley.edu> | |
echo "Initializing..." | |
echo "You have 3 seconds to hover over your friend's cog menu." | |
sleep 3 | |
eval $(xdotool getmouselocation --shell) | |
CMX=$X | |
CMY=$Y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() { | |
int a[2] = {1, 2}, b = 3; | |
memset(a, 0, 12); | |
printf("a1 = %d, a2 = %d, b = %d\n", a[0], a[1], b); | |
int d[2] = {2, 3}, c = 1; | |
memset(&c, 0, 12); | |
printf("c = %d, d1 = %d, d2 = %d\n", c, d[0], d[1]); | |
printf( "&a[] = %p\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
# unshred.py - Vedant Kumar <vsk@berkeley.edu> | |
import sys | |
import math | |
import colorsys | |
from collections import deque | |
from PIL import Image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(bst). | |
-export([bst_create/0, bst_insert/2, bst_search/2]). | |
bst_create() -> []. | |
bst_insert(Bst, N) -> | |
case Bst of | |
[] -> [N, [], []]; | |
[Root, Lhs, Rhs] -> | |
if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
>>> find('rage') | |
{'ager', 'gear', 'rage'} | |
>>> find('lascivious') | |
{'viscus', 'salvo', 'ciao', 'souls', 'lacs', 'ovisac', 'clavi', 'lasso', 'ovals', 'laics', 'solus', 'vail', 'ulvas', 'voila', 'cusso', 'assoil', 'ossa', 'cuss', 'sauls', 'iliac', 'cols', 'vails', 'sialic', 'silo', 'loss', 'ulva', 'louis', 'colas', 'salvos', 'saul', 'visuals', 'salic', 'ovisacs', 'ascus', 'coss', 'ails', 'cilia', 'sail', 'sous', 'laic', 'aviso', 'oculi', 'viol', 'vaus', 'avos', 'caulis', 'sola', 'aioli', 'oasis', 'sols', 'lass', 'vacs', 'cauls', 'cola', 'cavils', 'soli', 'civil', 'aiolis', 'sials', 'locus', 'sacs', 'oval', 'silva', 'sisal', 'casus', 'clivia', 'vials', 'visas', 'ocas', 'calo', 'viscous', 'silvas', 'avisos', 'silicas', 'clavus', 'oils', 'visual', 'coulis', 'asci', 'luvs', 'clivias', 'sial', 'socials', 'vial', 'coals', 'soul', 'vocal', 'ossia', 'vocals', 'silvics', 'loca', 'soil', 'loci', 'aulic', 'soils', 'ilia', 'viols', 'oscula', 'silos', 'violas', 'sics', 'also', 'viola', 'sails', 'lavs', 'cavil', 'coils', ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (yin-yang n) | |
(define yv | |
(for/vector ([i (in-range n)]) | |
((lambda (cc) (printf "~a " i) cc) (call/cc (lambda (k) k))))) | |
(for ([i (in-range (- n 1))]) | |
((vector-ref yv i) (vector-ref yv (+ i 1))))) | |
;; > (yin-yang 0) | |
;; > (yin-yang 1) | |
;; 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
from random import random | |
from flotype.bridge import Bridge | |
bridge = Bridge(api_key='abcdefgh') | |
def start_job(): | |
n = 32 |