Skip to content

Instantly share code, notes, and snippets.

View autosquid's full-sized avatar

mightu autosquid

  • HangZhou, ZheJiang, China.
View GitHub Profile
@autosquid
autosquid / find-package.el
Last active April 25, 2017 03:20
simple way to find package name
;;; autopyimport.el --- Import python packages automatically
;; Copyright(C) 2017 CAPG Lab., Zhejiang University.
;; Author: Z. Wang <justin.seeley.cn@gmail.com>
;; Version: 1.0
;; Package-Requires: (())
;; Keywords: python, import
@autosquid
autosquid / gist:3778f46005552048e7e9598ccdfe6ba9
Created April 20, 2017 13:23
script to determine os type
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
@autosquid
autosquid / tmux-cheatsheet.markdown
Created April 20, 2017 03:55 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@autosquid
autosquid / gist:57a71ffba436c9f1d869f1a280c1e80a
Created April 19, 2017 13:42
sources.list for docker in China
FROM ubuntu:16.04
MAINTAINER autosuqid <justin.seeley.cn@gmail.com>
RUN echo "deb http://ftp.sjtu.edu.cn/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list && \
echo "deb http://ftp.sjtu.edu.cn/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://ftp.sjtu.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://ftp.sjtu.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://ftp.sjtu.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb-src http://ftp.sjtu.edu.cn/ubuntu/ trusty main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb-src http://ftp.sjtu.edu.cn/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list && \
@autosquid
autosquid / rename
Created April 15, 2017 09:56
remove '_' in basename: 1_.2.3 -> 1.2.3
import os
import shutil
import click
@click.group()
def cli():
pass
def isfmt(f):
@autosquid
autosquid / README.md
Created March 25, 2017 11:25 — forked from amroamroamro/README.md
[Python] Fitting plane/surface to a set of data points

Python version of the MATLAB code in this Stack Overflow post: http://stackoverflow.com/a/18648210/97160

The example shows how to determine the best-fit plane/surface (1st or higher order polynomial) over a set of three-dimensional points.

Implemented in Python + NumPy + SciPy + matplotlib.

quadratic_surface

conda install pyqt=4
conda install -c https://conda.binstar.org/menpo opencv
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@autosquid
autosquid / blender_cam.py
Last active March 29, 2023 07:10
blender-camera-from-3x4-matrix
# from: http://blender.stackexchange.com/questions/40650/blender-camera-from-3x4-matrix?rq=1
# And: http://blender.stackexchange.com/questions/38009/3x4-camera-matrix-from-blender-camera
# Input: P 3x4 numpy matrix
# Output: K, R, T such that P = K*[R | T], det(R) positive and K has positive diagonal
#
# Reference implementations:
# - Oxford's visual geometry group matlab toolbox
# - Scilab Image Processing toolbox
@autosquid
autosquid / memo.i
Created January 25, 2017 08:46
swig pitfalls
%typemap(argout) std::vector<tex::TextureView>* {
/* { the last parameter is "whether python own the object behind the pointer" */
/* in this case: $1 is points to `temp`, managed by vector, so python does not own it */
/* to return something python own, we need to `new` a object */
/* so instead of the following */
/* $result = swig::from_ptr($1, 1); */
/* we use: }*/
$result = swig::from(*$1);
}