Skip to content

Instantly share code, notes, and snippets.

View yuki-inaho's full-sized avatar

yuki-inaho

View GitHub Profile
@autosquid
autosquid / opencvyaml1-1.py
Last active September 26, 2022 08:08
pyyaml loading opencv yaml
# construct node
def opencv_matrix(loader, node):
mapping = loader.construct_mapping(node, deep=True)
mat = np.array(mapping["data"])
mat.resize(mapping["rows"], mapping["cols"])
return mat
yaml.add_constructor(u"tag:yaml.org,2002:opencv-matrix", opencv_matrix)
# loading
@liborw
liborw / stargen.py
Created November 25, 2015 08:30
Simens star chart generator
#!/usr/bin/env python
"""Siemens star chart generator
Usage:
stargen.py [options] <output>
Options:
-h, --help Show this message
-n N Number of rays [default: 100]
@santa4nt
santa4nt / HelloJNI.java
Last active January 23, 2026 14:11
Sample JNI/C++ HelloWorld
public class HelloJNI {
static {
System.loadLibrary("hello"); // loads libhello.so
}
private native void sayHello(String name);
public static void main(String[] args) {
new HelloJNI().sayHello("Dave");
}
@PaulFurtado
PaulFurtado / usb_reset.py
Last active June 22, 2024 22:44
Reset USB device from python
"""
Example code for resetting the USB port that a Teensy microcontroller is
attached to. There are a lot of situations where a Teensy or Arduino can
end up in a bad state and need resetting, this code is useful for
"""
import os
import fcntl
import subprocess
@carymrobbins
carymrobbins / partialmethod.py
Last active April 22, 2023 11:25
Partial method for Python 2.7
from functools import partial
class partialmethod(partial):
def __get__(self, instance, owner):
if instance is None:
return self
return partial(self.func, instance,
*(self.args or ()), **(self.keywords or {}))
@CarloNicolini
CarloNicolini / ralign
Created October 23, 2013 12:47
Umeyama algorithm for absolute orientation problem in Python
"""
RALIGN - Rigid alignment of two sets of points in k-dimensional
Euclidean space. Given two sets of points in
correspondence, this function computes the scaling,
rotation, and translation that define the transform TR
that minimizes the sum of squared errors between TR(X)
and its corresponding points in Y. This routine takes
O(n k^3)-time.
Inputs:
@jeanpat
jeanpat / SkeletonToGraph.ipynb
Last active June 11, 2021 11:05
A ipython notebook. Takes an image, converts its skeleton to a networkx graph
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@endolith
endolith / color_scale.py
Last active November 22, 2024 06:05
Lch color scale colormap in Python
"""
Created on Thu Feb 28 14:28:50 2013
Produces colormaps by curving through Lch color space, inspired by
"Lab color scale" by Steve Eddins 09 May 2006 (Updated 10 May 2006)
(BSD license)
http://www.mathworks.co.uk/matlabcentral/fileexchange/11037-lab-color-scale
Chroma should probably be limited to the RGB cube in a way that never
produces sharp angles in the curve, which appear as bands in the gradient.
@AtsushiSakai
AtsushiSakai / ReductionSample.cpp
Created March 23, 2013 11:24
行列演算ライブラリEigenの換算(Reduction)関連(平均,最大値,最小値,各行・列への演算)の関数サンプルプログラム
/*
FileName: ReductionSample.cpp
Discription:行列演算ライブラリEigenの換算関数のサンプル
Author: Atsushi Sakai
Update: 2013/03/23
@flada-auxv
flada-auxv / .zshrc
Created November 10, 2012 05:37
tmuxの設定関連
# 一部抜粋
# emacsのエイリアス
alias e='emacsclient -t'
alias kille="emacsclient -e '(kill-emacs)'"
if pgrep emacs >/dev/null 2>&1; then
echo "Emacs server is already running..."
else
`emacs --daemon`
fi