Skip to content

Instantly share code, notes, and snippets.

View takamin's full-sized avatar
🏢

Koji Takami takamin

🏢
View GitHub Profile
/**
* datespinner "yyyy/mm/dd"
*/
$.widget( "ui.datespinner", $.ui.spinner, {
options: { step: 60*60*24*1000, page: 60*60*24*1000 },
_parse: function( value ) {
if ( typeof value === "string" ) {
if ( Number( value ) == value ) {
return Number( value );
}
#!/usr/bin/env python
import sys
import cv2
import numpy as np
print "opencv-" + cv2.__version__ + "\n"
cap = None
image_index = None
/**
* # cvCascade.cpp
*
* ## CMakeLists.txt
* ```
* cmake_minimum_required(VERSION 2.8)
* project( cvCascade )
* find_package( OpenCV REQUIRED )
* add_executable( cvCascade cvCascade.cpp )
* target_link_libraries( cvCascade ${OpenCV_LIBS} )
#
# CMakeLists.txt to generate a Makefile for a simple c++ project using OpenCV.
#
# cmake -D OpenCV_DIR="C:/opencv" ../source
#
cmake_minimum_required(VERSION 2.8)
project( <project-name> )
find_package( OpenCV REQUIRED )
add_executable( <executable-name> cvCascade.cpp )
target_link_libraries( <executable-name> ${OpenCV_LIBS} )
import sys
import numpy as np
import cv2
import pylab as plt
capL = cv2.VideoCapture(int(sys.argv[1]))
capR = cv2.VideoCapture(int(sys.argv[2]))
imgL = np.zeros((480,640,3), np.uint8)
imgR = np.zeros((480,640,3), np.uint8)
while True:
@takamin
takamin / sjis2utf8.cpp
Created November 12, 2014 05:37
convert Shift-JIS string to utf-8 on Visual C++ (Microsoft Visual Studio Express 2013 for Windows Desktop)
#include "stdafx.h"
#include <string>
//VC++ SJIS string を utf-8のstringに変換する
string sjis2utf8(const string& sjis) {
string utf8_string;
//一旦SJISからutf-16へ変換
LPCCH pSJIS = (LPCCH)sjis.c_str();
int utf16size = ::MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, pSJIS, -1, 0, 0);
@takamin
takamin / IsRunningOnX64.cpp
Last active August 29, 2015 14:10
[Windows VC++] Check whether the current process is running on the x64
#include <Windows.h>
BOOL IsRunningOnX64()
{
BOOL isRunningOnX64 = FALSE;
typedef BOOL(WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS IsWow64Process =
(LPFN_ISWOW64PROCESS)GetProcAddress(
GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
if (IsWow64Process != 0) {
IsWow64Process(GetCurrentProcess(), &isRunningOnX64);
@takamin
takamin / RFC2822_AddrSpec.class.php
Created February 4, 2015 02:20
Inspection of e-mail addresses based on the specification of the RFC2822 Addr-spec
<?php
/**
* e-mail address specification.
*
* http://blog.livedoor.jp/dankogai/archives/51189905.html
*
* RFC-2822 3.4.1 Addr-spec specification
* https://www.ietf.org/rfc/rfc2822.txt
*/
class RFC2822_AddrSpec {
@takamin
takamin / jquery.uitext.js
Last active August 29, 2015 14:14
the TextBox plugin that utilizes styles jquery-ui.spinner
$.fn.uitext = function() {
this.addClass("ui-spinner-input")
.css({'margin-right':'.4em'})
.appendTo(
$('<span/>')
.addClass("ui-spinner")
.addClass("ui-widget")
.addClass("ui-widget-content")
.addClass("ui-corner-all")
.insertBefore(this));
<?php
if(count($argv) != 2) {
exit;
}
$executable_suffixies = array("cmd", "bat", "dll", "exe");
$filename = $argv[1];
$no_suffix = !has_suffix($filename, $executable_suffixies);
$pathes = preg_split('/;/', getenv('PATH'));
foreach( $pathes as $path ) {
echo_file_exists("$path\\$filename");