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
#include <iostream> | |
#include <string> | |
#include <bitset> | |
#include <ctime> | |
using namespace std; | |
// dynamic programming | |
const int SIZE = 100; |
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
import android | |
from wsgiref.simple_server import make_server | |
droid=android.Android() | |
pic='/sdcard/snapshot.jpg' | |
def camera(env,res): | |
if env['PATH_INFO']=='/': | |
droid.cameraCapturePicture(pic) | |
res('200 OK',[('Content-type','image/jpeg')]) |
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/env python | |
import sys, os | |
from pylab import * | |
gcd = lambda x, y: y and gcd(y, x % y) or x | |
fx = lambda t, rc, rm, rd: (rc - rm) * cos(t * pi) + rd * cos(t * pi * (rc - rm) / rm) | |
fy = lambda t, rc, rm, rd: (rc - rm) * sin(t * pi) - rd * sin(t * pi * (rc - rm) / rm) | |
p = lambda x, rc, rm, rd: plot(fx(x, rc, rm, rd), fy(x, rc, rm, rd)) |
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/env python | |
import sys | |
import os | |
import math | |
import time | |
from PIL import Image | |
def tetration(l, t, w, h, sw, sh, mit): | |
data = [] |
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/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import time | |
import json | |
import time | |
import threading | |
import datetime | |
import Queue |
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/env python | |
# -*- coding: utf-8 -*- | |
def tarai(x, y, z): | |
return tarai(tarai(x - 1, y, z), | |
tarai(y - 1, z, x), | |
tarai(z - 1, x, y)) if x > y else y | |
def factorial(n): | |
return n == 0 and 1 or reduce(lambda x, y: x * y, range(1, n + 1)) |
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
// Count paths from (0, 0) to (N, N) in the NxN lattice graph using DFS. | |
#include <iostream> | |
#include <sstream> | |
#include <vector> | |
using namespace std; | |
static unsigned long long cnt = 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/env python | |
""" | |
Count all paths from upper left to lower right on NxN lattice graph. | |
Build (required SGB and GMP libraries): | |
% gcc gen_lattice.c -O3 -lgb -o gen_lattice | |
% wget http://www-cs-faculty.stanford.edu/~uno/programs/simpath.w | |
% ctangle simpath.w | |
% gcc simpath.c -O3 -lgb -o simpath | |
% wget http://www-cs-faculty.stanford.edu/~uno/programs/simpath-reduce.w |
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
// Count paths on a lattice graph. | |
#include <iostream> | |
#include <fstream> | |
#include <sstream> | |
#include <vector> | |
#include <algorithm> | |
#include <gmp.h> |
NewerOlder