Skip to content

Instantly share code, notes, and snippets.

View takamin's full-sized avatar
🏢

Koji Takami takamin

🏢
View GitHub Profile
@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 / 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);
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:
#
# 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} )
/**
* # 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} )
#!/usr/bin/env python
import sys
import cv2
import numpy as np
print "opencv-" + cv2.__version__ + "\n"
cap = None
image_index = None
/**
* 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 );
}
/**
* timespinner "hh:mm"
*/
$.widget( "ui.timespinner", $.ui.spinner, {
options: { step: 1, page: 1 },
_parse: function( value ) {
if ( typeof value === "string" ) {
if ( Number( value ) == value ) {
return Number( value );
}
@takamin
takamin / jma_get.php
Last active October 15, 2019 23:33
気象庁のサイトから情報を得るPHPスクリプト
<?php
/**
* 気象庁のサイトから都府県・地方データの一覧を得る
* @return array ('name'=>名称,'prec_no'=>都府県・地方No)
*/
function jma_get_prec_list() {
$url = "http://www.data.jma.go.jp/obd/stats/etrn/select/prefecture00.php";
@takamin
takamin / .wait_jquery.RawGit.html
Last active August 29, 2015 14:06
jqueryが読み込まれる前のSCRIPTでjqueryが使えるようになるまで待つ
<!-- load a gist directly by using RawGit -->
<script
type="text/javascript"
src="https://cdn.rawgit.com/takamin/d39bf8ccff805baecb1b/raw/faf22f4f507673ce3143b82ee842dcf5b2130c2a/wait_jquery.js"
></script>