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 / bow+svm+2class.py
Created May 10, 2016 09:17
Bow + SVM for front/back face determination
"""BoW on SIFT"""
import changetoworkingdir #changes to working dir.
import os
import hammer
import pongeecore as pc
import cv2
import numpy as np
import random
import matplotlib
@autosquid
autosquid / uneven.py
Created May 20, 2016 03:21
irregularly sampled signal reconstruction
import numpy as np
import pylab as py
import scipy.interpolate as spi
import numpy.random as npr
import numpy.linalg as npl
npr.seed(0)
class Signal(object):
@autosquid
autosquid / antennafb.py
Created June 24, 2016 01:51
An Example of Bag of Visual Words (on Antenna Data)
#coding: utf-8
"""BoW on SIFT
Given a image of antenna, output wheater it is front-face of back-face.
"""
import os
from changetoworkingdir import *
import hammer
@autosquid
autosquid / makefile
Created September 19, 2016 09:34
makefile in python
.PHONY: clean-pyc clean-build
clean-pyc:
find . -name '*.pyc' -exec rm --force {} +
find . -name '*.pyo' -exec rm --force {} +
find . -name '*~' -exec rm --force {} +
clean-build:
rm --force --recursive build/
rm --force --recursive dist/
(defun kill-buffers-after (idx limit list)
(when list
(when (> idx limit) (kill-buffer (car list)))
(kill-buffers-after (+ idx 1) limit (cdr list))))
(kill-buffers-after 0 20 (buffer-list))
@autosquid
autosquid / recycler.el
Created November 3, 2016 01:54
Kill least used buffers.
(defun kill-buffers-after (idx limit list)
(when list
(when (> idx limit) (kill-buffer (car list)))
(kill-buffers-after (+ idx 1) limit (cdr list))))
(kill-buffers-after 0 20 (buffer-list))
@autosquid
autosquid / gist:847c8af594570a2797af0ba1b2017452
Created December 8, 2016 03:15
update python in virtualenv
Updated: I changed the answer 5 months after I originally answered. The following method is more convenient and robust.
Side effect: it also fixes the Symbol not found: _SSLv2_method exception when you do import ssl in a virtual environment after upgrading Python to v2.7.8.
Notice: Currently, this is for Python 2.7.x only.
If you're using Homebrew Python on OS X, first deactivate all virtualenv, then upgrade Python:
brew update && brew upgrade python
Run the following commands (<EXISTING_ENV_PATH> is path of your virtual environment):
@autosquid
autosquid / gist:e90c2df2682a1ef38062ec25e52db323
Created December 8, 2016 03:15
update python in virtualenv
Updated: I changed the answer 5 months after I originally answered. The following method is more convenient and robust.
Side effect: it also fixes the Symbol not found: _SSLv2_method exception when you do import ssl in a virtual environment after upgrading Python to v2.7.8.
Notice: Currently, this is for Python 2.7.x only.
If you're using Homebrew Python on OS X, first deactivate all virtualenv, then upgrade Python:
brew update && brew upgrade python
Run the following commands (<EXISTING_ENV_PATH> is path of your virtual environment):
@autosquid
autosquid / update python in virtualenv.md
Created December 8, 2016 03:15
update python in virtualenv

Updated: I changed the answer 5 months after I originally answered. The following method is more convenient and robust.

Side effect: it also fixes the Symbol not found: _SSLv2_method exception when you do import ssl in a virtual environment after upgrading Python to v2.7.8.

Notice: Currently, this is for Python 2.7.x only.

If you're using Homebrew Python on OS X, first deactivate all virtualenv, then upgrade Python:

brew update && brew upgrade python Run the following commands (<EXISTING_ENV_PATH> is path of your virtual environment):

@autosquid
autosquid / timer.h
Created January 22, 2017 08:42
user time and process time
/*
* Copyright (C) 2015, Simon Fuhrmann
* TU Darmstadt - Graphics, Capture and Massively Parallel Computing
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the BSD 3-Clause license. See the LICENSE.txt file for details.
*
* - WallTimer: A real world "user" time timer.
* Useful for timings displayed to the user.