Skip to content

Instantly share code, notes, and snippets.

@kou1okada
kou1okada / testSCNu8.cpp
Last active September 15, 2016 12:28
test code for SCNu8.
/**
* test code for SCNu8
* Copyright (c) 2016 Koichi OKADA. All rights reserved.
* This code is distributed under the MIT license.
*
* References:
* - MSDN / Visual Studio 2013 / [scanf Width Specification](https://msdn.microsoft.com/en-us/library/xdb9w69d(v=vs.120).aspx)
* - MSDN / Visual Studio 2015 / [scanf Width Specification](https://msdn.microsoft.com/en-us/library/xdb9w69d(v=vs.140).aspx)
* - die.net / [vscanf(3)](http://linux.die.net/man/3/vscanf)
* - JM / [scanf(3)](https://linuxjm.osdn.jp/html/LDP_man-pages/man3/scanf.3.html)
@kou1okada
kou1okada / vcvars.bat
Last active August 26, 2016 13:38
Utilitiey for VisualStudio using from command line.
@ECHO OFF
REM -------------------------------------------------------
REM vcvarsall wrapper
REM Copyright (c) 2016 Koichi OKADA. ALl rights reserved.
REM This script is distributed under the MIT license.
REM -------------------------------------------------------
set VS11_VCVARSALL=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat
set VS12_VCVARSALL=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
set VS14_VCVARSALL=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
@kou1okada
kou1okada / md2html.rb
Last active June 13, 2016 13:56
Markdown to HTML using GitHub API
#!/usr/bin/env ruby
#
# md2html.rb
# Copyright (c) 2016 Koichi OKADA. All rights reserved.
# This script is distributed under the MIT license.
#
require 'io/console'
require 'json'
require 'uri'
@kou1okada
kou1okada / ntfsddinfo.rb
Last active June 10, 2016 12:17
NTFS Dynamic Disk Information tool
#!/usr/bin/env ruby
#
# ntfsddinfo.rb - NTFS Dynamic Disk infomation tool.
# Copyright (c) 2016 Koichi OKADA. All rights reserved.
# This script is distributed under the MIT license.
#
require 'optparse'
$conf = {}
@kou1okada
kou1okada / rdpcheck.sh
Created March 1, 2016 02:10
rdpcheck.sh - RDP response checker
#!/usr/bin/env bash
function rdpcheck ()
{
echo -e '\x03\x00\x00\x13\x0e\xe0\x00\x00\x00\x00\x00\x01\x00\x08\x00\x0b\x00\x00\x00' | nc "$1" 3389 | xxd
}
rdpcheck "$1"
@kou1okada
kou1okada / ren.rb
Last active December 15, 2017 13:44
ren.rb - rename by the regular expressions
#!/usr/bin/env ruby
#
# ren.rb - rename by the regular expressions
# Copyright (c) 2016 Koichi OKADA. All rights reserved.
# This script is distributed under the MIT license.
#
require 'optparse'
$config = {
@kou1okada
kou1okada / wmic2tsv.rb
Last active February 26, 2016 09:11
wmic2tsv.rb: Convert WMIC to TSV.
#!/bin/sh
exec ruby -lnx "$0" "$@"
#!ruby
# encoding: utf-8
#
# Copyright (c) 2016 Koichi OKADA. All right reserved.
# This script is distributed under the MIT license.
#
BEGIN {
cmd = File.basename $0
@kou1okada
kou1okada / Makefile
Last active February 17, 2016 14:56
Example of the dll by the cygwin
all: call libmsg.so
call: call.c
$(CC) $< -o $@
libmsg.so: libmsg.c
$(CC) -shared $< -o $@
clean:
-$(RM) -v call libmsg.so
test: all
./call user32.dll MessageBoxA "MessageBoxA()" user32.dll
@kou1okada
kou1okada / getpw.rb
Last active November 28, 2017 10:38
getpw.rb - Prototype of getpw function using io/console#getch function
#!/usr/bin/env ruby
#
# getpw.rb
# Copyright (c) 2016 Koichi OKADA. All right reserved.
# This script distributed under the MIT license.
#
require 'io/console'
def getpw
@kou1okada
kou1okada / opencv-3.1.0-cygwin.patch
Created January 16, 2016 11:56
OpenCV 3.1.0 patch for cygwin.
*** opencv-3.1.0.orig/modules/core/src/parallel.cpp 2016-01-16 20:39:07.880186500 +0900
--- opencv-3.1.0/modules/core/src/parallel.cpp 2016-01-16 20:46:56.376797500 +0900
***************
*** 50,56 ****
#undef abs
#endif
! #if defined __linux__ || defined __APPLE__
#include <unistd.h>
#include <stdio.h>