Skip to content

Instantly share code, notes, and snippets.

@zxytim
zxytim / distort.py
Created January 31, 2017 09:45
Distortion
#!/usr/bin/env mdl
# -*- coding: utf-8 -*-
# $File: qr.py
# $Author: Xinyu Zhou <zxy@megvii.com>
# Copyright (c) 2015 Megvii Inc. All rights reserved.
import cv2
from scipy.ndimage import interpolation, filters
import numpy as np
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 / 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
@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()
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# $File: push-phone
# $Date: Thu Sep 18 11:29:13 2014 +0800
# $Author: Xinyu Zhou <zxytim[at]gmail[dot]com>
import sys
import getpass
import socket
import argparse
//#include "opencv_traits.hh"
#include <opencv2/core/core.hpp>
#include <set>
#include <tuple>
#include <map>
#include <vector>
template <typename value_t>
//#include "opencv_traits.hh"
#include <opencv2/core/core.hpp>
#include <set>
#include <tuple>
#include <map>
#include <vector>
struct Value {
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# $File: prefetch.py
# $Date: Tue Aug 26 18:12:01 2014 +0800
# $Author: Xinyu Zhou <zxytim[at]gmail[dot]com>
from multiprocessing import Pool
from collections import deque
@zxytim
zxytim / a.cc
Last active August 29, 2015 14:05
strange behavior of auto type deduction in c++14
/*
$ g++ a.cc -o a -std=c++1y
$ ./a
3.1
3.1
3
3.1
3
3.1
/*
* $File: class_uniq_thread_job_pool.hh
* $Date: Sat Jan 18 14:33:53 2014 +0800
* $Author: Xinyu Zhou <zxytim[at]gmail[dot]com>
*/
#pragma once
#include <vector>
#include <queue>