Skip to content

Instantly share code, notes, and snippets.

@ikarino
ikarino / mbaCamera.cpp
Last active August 29, 2015 14:09
MacbookAirのカメラ
#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
int main(int argc, char** argv) {
cv::VideoCapture cap(1);
cv::namedWindow("window", 1);
while(true) {
cv::Mat frame;
@ikarino
ikarino / template_matching_for_anytimes_for_anyrange.cc
Last active August 29, 2015 14:09
適当な画像(テンプレート)を適当な範囲で適当な回数検出する
#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <vector>
int main(int argc, char** argv) {
cv::VideoCapture cap(1);
if(!cap.isOpened()) {
std::cout << "Camera couldn't open !\n";
@ikarino
ikarino / root_install.sh
Created November 19, 2014 12:10
RootをOS X Mavericksにインストールした時のconfigure
./configure macosx64 --prefix=/usr/local --enable-x11 --enable-opengl
make -j4
sudo make install
@ikarino
ikarino / .bashrc_root
Created November 19, 2014 12:21
.bashrc_root
if [ -f /usr/local/bin/thisroot.sh ]; then
. /usr/local/bin/thisroot.sh
fi
@ikarino
ikarino / plotADC1.gp
Last active August 29, 2015 14:10
successive file into gif animation by gnuplot
#!/usr/bin/env gnuplot
set term gif animate optimize
set output 'ADC1.gif'
do for[i=0:8:1] {
file = sprintf("ADC1-%03d.dat", i)
time = sprintf("t=%d-%d[sec]", i*200, (i+1)*200)
set title time
plot file w l
}
bash-3.2$ ls -1
ADC1-000.dat
ADC1-001.dat
ADC1-002.dat
ADC1-003.dat
ADC1-004.dat
ADC1-005.dat
ADC1-006.dat
ADC1-007.dat
ADC1-008.dat
@ikarino
ikarino / fit.py
Last active August 29, 2015 14:10
fit
#!/usr/bin/env python2.7
import numpy
import scipy
import scipy.optimize
import subprocess
def plotme(gnuplottext, filename=None):
if filename:
@ikarino
ikarino / checkgxx.py
Created December 3, 2014 15:42
check version of g++ in Sakura
#!/usr/local/bin/python
import subprocess
print 'Content-type: text/html; charset=utf-8'
print "\r\n\r\n"
print "Checking status<br />"
proc = subprocess.Popen("/usr/bin/g++ -v", shell=True,
@ikarino
ikarino / proc.py
Last active August 29, 2015 14:11
bottle_subprocess
#!/usr/bin/env python
import subprocess
@route('/command', method='GET')
def out():
stdout = ""
stderr = ""
command = None
command = request.GET.get("command")
if command:
@ikarino
ikarino / command.tpl
Created December 19, 2014 12:15
bottle_subprocess
<body>
<h3>cmd</h3>
<form method="get" action="/cmd">
<input type="text" name="cmd">
<input type="submit" value="exec">
</form>
<h3>stdout</h3>
<tt>
%for out in stdout:
{{out}}<br />