Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Focusing

潘伟洲 wzpan

:octocat:
Focusing
View GitHub Profile
@wzpan
wzpan / fibonacci.py
Last active December 5, 2022 23:17
Python - Fibonacci Iterator
View fibonacci.py
class Fib:
def __init__(self, max):
self.max = max
def __iter__(self):
self.a = 0
self.b = 1
return self
def __next__(self):
@wzpan
wzpan / redmine gitlab sync
Created February 16, 2016 04:01 — forked from jakimowicz/redmine gitlab sync
simple (and dirty) sync between redmine issues and gitlab issues
View redmine gitlab sync
#!/usr/bin/env ruby
require 'faraday'
require 'json'
require 'gitlab'
module Redmine
Host = nil
APIKey = nil
@wzpan
wzpan / timestamp.py
Created August 20, 2013 12:07
Python - timestamp
View timestamp.py
import datetime
# 2012-12-15 10:14:51.898000
print datetime.datetime.utcnow()
# The now differs from utcnow as expected
# otherwise they work the same way:
# 2012-12-15 11:15:09.205000
print datetime.datetime.now()
@wzpan
wzpan / CameraCalibrator.cpp
Last active January 12, 2022 15:40
CV - Calibrate camera from detected chess pattern corners.
View CameraCalibrator.cpp
/*------------------------------------------------------------------------------------------*\
This file contains material supporting chapter 9 of the cookbook:
Computer Vision Programming using the OpenCV Library.
by Robert Laganiere, Packt Publishing, 2011.
This program is free software; permission is hereby granted to use, copy, modify,
and distribute this source code, or portions thereof, for any purpose, without fee,
subject to the restriction that the copyright notice may not be removed
or altered from any source or altered source distribution.
The software is released on an as-is basis and without any warranties of any kind.
@wzpan
wzpan / CMakeLists.txt
Last active December 20, 2021 09:13
Perform FFT and IFFT operation on an image, based on FFTW and OpenCV 2.
View CMakeLists.txt
# Copyright (c) 2012 Marwan Abdellah <abdellah.marwan@gmail.com>
# Minimum required CMake version
cmake_minimum_required(VERSION 2.6)
# FFT
PROJECT(FFT_CV)
# Add CMake modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
@wzpan
wzpan / strassen.cpp
Created September 10, 2013 03:00
C++ - strassen algorithm
View strassen.cpp
#include <iostream>
using namespace std;
const int N = 6; //Define the size of the Matrix
template<typename T>
void Strassen(int n, T A[][N], T B[][N], T C[][N]);
template<typename T>
@wzpan
wzpan / speedup.py
Created June 1, 2015 16:17
A python script to speed up the rendering process of Hexo 3.
View speedup.py
#!/usr/bin/python2
'''
SYNOPSIS:
$ python speedup.py -f FILE
or
$ python speedup.py -d DIR
'''
@wzpan
wzpan / raise.py
Created August 17, 2013 04:07
Python - raise
View raise.py
#!/usr/bin/python
# Filename: raising.py
class ShortInputException(Exception):
'''A user-defined exception class.'''
def __init__(self, length, atleast):
Exception.__init__(self)
self.length = length
self.atleast = atleast
try:
@wzpan
wzpan / hexo_compile.sh
Last active February 19, 2019 13:42
A script to help me generate hexo blog and publish it to gitcafe.
View hexo_compile.sh
#!/bin/zsh
CUR_DIR=$PWD
HEXO=/Users/wzpan/Documents/workspace/repositories/hexo-blog
PUBLISH=/Users/wzpan/Documents/workspace/repositories/wzpan
CSS=$HEXO/themes/bootstrap/source/css
JS=$HEXO/themes/bootstrap/source/js
DIST=$HEXO/themes/bootstrap/source/dist
PUBLIC=$HEXO/public
@wzpan
wzpan / RobustMatcher.h
Last active September 24, 2018 13:50
CV - match images using random sample consensus(RANSAC).
View RobustMatcher.h
/*------------------------------------------------------------------------------------------*\
This file contains material supporting chapter 9 of the cookbook:
Computer Vision Programming using the OpenCV Library.
by Robert Laganiere, Packt Publishing, 2011.
This program is free software; permission is hereby granted to use, copy, modify,
and distribute this source code, or portions thereof, for any purpose, without fee,
subject to the restriction that the copyright notice may not be removed
or altered from any source or altered source distribution.
The software is released on an as-is basis and without any warranties of any kind.