Skip to content

Instantly share code, notes, and snippets.

@zxytim
zxytim / x.py
Created September 23, 2014 15:46
X = 0
Y = 0
def wrapper():
X = 1
Y = 1
class C(object):
print X, Y # <- what happens at this line?
X = 2
wrapper()
@zxytim
zxytim / decorator.coffee
Created December 1, 2014 13:56
a python-like decorator in coffee script
timing = (msg) -> (method) -> ->
startTime = (new Date()).getTime()
ret = method.apply @, arguments
duration = (new Date()).getTime() - startTime
msg = if msg then msg else ''
console.log '[timing] ' + msg + ': ' + duration / 1000.0
ret
consumeTime = timing('hello') ->
s = 0
a52dec 0.7.4-8
abs 2.4.4-2
accerciser 3.14.0-1
acpi 1.7-1
acroread 9.5.5-5
addinclude 0.9-10
aircrack-ng 1.2rc1-1
aisleriot 3.14.2-1
akonadi 1.13.0-3
alex 3.1.4-1
@zxytim
zxytim / distort.py
Created January 31, 2017 09:45
Distortion
#!/usr/bin/env mdl
# -*- coding: utf-8 -*-
# $File: qr.py
# $Author: Xinyu Zhou <[email protected]>
# Copyright (c) 2015 Megvii Inc. All rights reserved.
import cv2
from scipy.ndimage import interpolation, filters
import numpy as np