Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

潘伟洲 wzpan

🎯
Focusing
View GitHub Profile
@wzpan
wzpan / strassen.cpp
Created Sep 10, 2013
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 / redmine gitlab sync
Created Feb 16, 2016 — 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 / fibonacci.py
Last active Dec 19, 2020
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 / speedup.py
Created Jun 1, 2015
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 / timestamp.py
Created Aug 20, 2013
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 / raise.py
Created Aug 17, 2013
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 / CMakeLists.txt
Last active Dec 30, 2019
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 / hexo_compile.sh
Last active Feb 19, 2019
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 Sep 24, 2018
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.
@wzpan
wzpan / CameraCalibrator.cpp
Last active Apr 9, 2018
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.