Skip to content

Instantly share code, notes, and snippets.

View suminb's full-sized avatar

Sumin Byeon suminb

View GitHub Profile
abstract class Tree
case class Add(l: Tree, r: Tree) extends Tree
case class Sub(l: Tree, r: Tree) extends Tree
case class Mul(l: Tree, r: Tree) extends Tree
case class Square(c:Const, b: Tree, e:Const) extends Tree
case class Var(n: String) extends Tree
case class Const(v: Int) extends Tree
trait Comparable {
def < (that: Any): Boolean
@suminb
suminb / shinhan.py
Created August 22, 2014 19:24
Data pre-processor for Moneydance
import csv
import sys
import time
DATE_COLUMN = 1
DESCRIPTION_COLUMN = 6
DEBIT_COLUMN = 4
CREDIT_COLUMN = 5
@suminb
suminb / camera.py
Created September 30, 2014 11:33
Take a picture with a Raspberry Pi camera
import picamera
def test_camera():
with picamera.PiCamera() as camera:
camera.capture('image.jpg')
if __name__ == '__main__':
test_camera()
@suminb
suminb / blink.go
Last active August 29, 2015 14:08
Controlling Raspberry Pi's GPIO with Python
@suminb
suminb / rent.py
Last active August 29, 2015 14:10
import inspect
#: Annual percentage rate of your savings account, certificate of deposit, etc.
APR = 0.032
TAX_RATE = 0.154
class Terms:
def __init__(self, deposit, rent, utilities, commute_time, commute_cost):
frame = inspect.currentframe()
@suminb
suminb / debugger.py
Created January 27, 2015 09:30
Easy Debugger (add this to $PATH/lib/python?.?/site-packages/b.pth)
import __builtin__; __builtin__.B = __import__('pdb').set_trace
import __builtin__; __builtin__.pprint = __import__('pprint').pprint
@suminb
suminb / effingpos.js
Created January 28, 2015 15:37
신한금융투자 웹사이트에서 PDF 파일 받기
var openPdf = function(filename) {
window.open('http://file.shinhaninvest.com/filedoc/otc/' + filename);
}
@suminb
suminb / matmul.py
Created February 3, 2015 12:20
Matrix Multiplication
import numpy as np
import pyopencl as cl
ROWS = 10
COLS = 10
def run():
a_np = np.random.rand(ROWS, COLS).astype(np.float32)
class retraceable_property(property):
"""A decorator that traces how a property changes over time.
In real life, you may find yourself in a situation in which you keep track
of a variable that changes over time. It may be a path of a moving object
or (something else; it's late at night and my brain is a bit cloudy so I
can't give you another brilliant example. I'll fill this in later). As an
over-simplified example, you may write code to keep adding two to a
variable in every
second as follows:
@suminb
suminb / currying.py
Created April 26, 2015 11:12
Test of currying in Python (written in Oct 12, 2010; found from a backup archive on Apr 26, 2015)
def f(n):
def g(m):
def h(s):
return m + n + s
return h
return g
a = f(1)(2)
print a
print a(3)