Skip to content

Instantly share code, notes, and snippets.

View denkiwakame's full-sized avatar
:octocat:
Working from home

Mai Nishimura denkiwakame

:octocat:
Working from home
View GitHub Profile
@denkiwakame
denkiwakame / operator.cc
Created November 11, 2016 01:59
よく忘れる
// 内からコンパレータ
struct msg {
float res;
float x;
float y;
cv::Vec<float, _LABEL_MAX_NUM_> values;
msg() : res(0.0) {};
msg(float res_) : res(res_) {};
msg(int x_, int y_) : res(0.0), x(x_), y(y_) {};
@denkiwakame
denkiwakame / cn.md
Last active January 19, 2022 07:25
苗字変わった

※ 2016年11月時点の内容です. 各市町村, 金融機関ごとに規定が異なるので必ず確認してください

① はんこ屋

  • 認印をすぐ買う
    • 旧姓・新姓の認印が両方入る印鑑ケースが便利. がま口系が丁度2本収納できる.
  • 銀行印は金融機関によって旧姓使用可のところがあるが, 変更した方が良い. 受取は2営業日〜7営業日後.
  • 苗字変わる予定がある婿or嫁はもともと認印・銀行印ともに下の名前で作った方が良い.

② 役所

住民票・税証明カード

@denkiwakame
denkiwakame / lambda.cc
Last active November 11, 2016 01:50
よく忘れる
// basic
float min = *std::min_element(v.begin(),v.end(),[](Type msg1, Type msg2) {return msg1.second > msg2.second };
float sum = std::accumulate(v.begin(), v.end(),0,[](const int sum, const Type& msg){ return sum + msg.second; })
// index sort
template<typename T>
std::vector<size_t> sort_index(std::vector<T> const& values) {
std::vector<size_t> indices(values.size());
std::iota(indices.begin(), indices.end(), static_cast<size_t>(0)); // init index
std::sort(indices.begin(), indices.end(), [&](size_t a, size_t b) { return values[a] < values[b]; }); // 昇順?
return indices;
@denkiwakame
denkiwakame / gist:b346675c2b7354e81918
Created November 10, 2015 02:09
google scholarで検索する
function scholar() {
local str opt
if [ $# != 0 ]; then # 引数が存在すれば
for i in $*; do
str="$str+$i"
done
str=`echo $str | sed 's/^\+//'` #先頭の「+」を削除
opt="scholar?q=${str}"
fi
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome http://scholar.google.co.jp/$opt #引数がなければ $opt は空になる
from types import *
import xlrd
def value2str(val,encoding='cp932'): # or utf-8
if type(val) == FloatType: return str(val)
if type(val) == UnicodeType: return val.encode(encoding)
if type(val) == StringType: return val
raise TypeError("cannot convert '%s' type:%s to string" % (val,type(val)))
@denkiwakame
denkiwakame / recursive_fpath.py
Last active August 29, 2015 14:23
grep filepath recursively
import os
from fnmatch import fnmatch
def get_fpath_list(dirpath, ext="*.xlsx"):
fpath_list = []
for root, dir_list, fname_list in os.walk(dirpath):
fpath_list.extend([ os.path.join(root,fname) for fname in fname_list if fnmatch(fname, ext)])
return fpath_list
document.getElementsByTagName('body')[0].contentEditable = true;
@denkiwakame
denkiwakame / gist:d5de263d386a2fc2e7d8
Created March 12, 2015 15:10
includeすればよい
/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/
/* [ Created with wxMaxima version 13.04.2 ] */
/* [wxMaxima: input start ] */
/*
get_M(_VARS,_F):=block([X,N,r,c,B,y,coeff,flag],
X:_VARS,
f:_F,
N:length(X),
M:[],
@denkiwakame
denkiwakame / gist:f78833a28c91ec83b569
Created February 6, 2015 12:00
mexコンパイル
[status, opencv_incdir] = system('pkg-config --cflags opencv');
[status, opencv_ldflags] = system('pkg-config --libs opencv');
opencv_incdir = opencv_incdir(1:end-3)
opencv_ldflags = opencv_ldflags(1:end-3)
TARGET_FILE='./src/readxml.cpp';
mex_compile_options = sprintf('mex CXX=g++ %s %s %s', opencv_incdir, opencv_ldflags, TARGET_FILE)
eval(mex_compile_options)
linestyles = cellstr(char('-',':','-.','--','-',':','-.','--','-',':','-',':',...
'-.','--','-',':','-.','--','-',':','-.'));
MarkerEdgeColors=jet(n); % n is the number of different items you have
Markers=['o','x','+','*','s','d','v','^','<','>','p','h','.',...
'+','*','o','x','^','<','h','.','>','p','s','d','v',...
'o','x','+','*','s','d','v','^','<','>','p','h','.'];
% [...]