This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; カレントバッファの内容をSQL*Plusで実行 | |
(defun exec-sqlplus () | |
(interactive) | |
(let ((user "SCOTT") | |
(passwd "TIGER") | |
(host "localhost") | |
(port 1521) | |
(service-name "XE") | |
(filename (make-temp-file-name)) | |
command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# win32screenshotで撮ったスクリーンショットをruby-opencvのCvMatに読み込むサンプル | |
require 'opencv' | |
require 'win32/screenshot' | |
require 'tempfile' | |
include OpenCV | |
# (1) スクリーンショットを撮る | |
screenshot = Win32::Screenshot::Take.of(:desktop) | |
# (2) スクリーンショットの画像データを一時ファイルに書き込んでからCvMat.loadで読み込む |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# win32screenshotで撮ったスクリーンショットをruby-opencvのCvMatに読み込む方法のベンチマーク | |
# | |
# 環境: Windows 7, Core i5 2.4GHz, メモリ 4.0GB, ディスプレイ解像度 1280x800px | |
# ruby 1.9.3p125 (2012-02-16) [i386-mingw32], OpenCV 2.3.1 | |
# | |
# > ruby benchmark.rb | |
# (1) Bitmapデータを配列にしてset_dataで読み込む版 | |
# user system total real | |
# 1.934000 0.062000 1.996000 ( 2.061118) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby-opencvのテンプレートマッチングのサンプル | |
# https://github.com/ruby-opencv/ruby-opencv | |
require 'opencv' | |
include OpenCV | |
# (1) 画像を読み込み | |
image = CvMat.load('image.jpg') # テンプレートと比較する画像 | |
template = CvMat.load('template.jpg') # テンプレート画像 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef tmuxinator mux | |
# zsh completion for tmuxinator | |
# Install: | |
# $ mkdir -p ~/.tmuxinator/completion | |
# $ cp _tmuxinator ~/.tmuxinator/completion | |
# $ vi ~/.zshrc # add the following codes | |
# fpath=($HOME/.tmuxinator/completion ${fpath}) | |
# autoload -U compinit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PowerShell Drag & Drop sample | |
# Usage: | |
# powershell -sta -file dragdrop.ps1 | |
# (-sta flag is required) | |
# | |
Function DragDropSample() { | |
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | |
$form = New-Object Windows.Forms.Form | |
$form.text = "Drag&Drop sample" | |
$listBox = New-Object Windows.Forms.ListBox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; AutoHotKey_LでEmacsキーバインドにするスクリプト | |
;; | |
;; 使い方 | |
;; ・AutoHotKey_L(http://l.autohotkey.net/)をインストール | |
;; ・Emacs.ahkをAutoHotkeyをインストールしたフォルダ(デフォルトならC:\Program Files\AutoHotkey)に保存 | |
;; ・タスクバーにあるAutoHotkeyのアイコン([H])を右クリックし、"Edit This Script"を選択 | |
;; ・メモ帳でAutoHotkey.ahkが開くので、最後に以下の行を追加 | |
;; #include Emacs.ahk | |
;; ・AutoHotkeyアイコンを右クリックして"Reload This Script"を選択してリロード | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- mode: ruby; coding: utf-8-unix -*- | |
# Sudoku solver for Dropquest | |
# https://www.dropbox.com/dropquest2011/ | |
require 'pp' | |
CANDIDATES = 'AFERDOWSI'.split(//) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
void merge_sort(int* data, int size); | |
void merge(int* data1, int size1, int* data2, int size2, int* result); | |
void merge_sort(int* data, int size) | |
{ | |
int size1, size2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* -*- mode: c; coding: utf-8-unix -*- */ | |
/* | |
Level set method | |
Build: | |
gcc `pkg-config --libs --cflags opencv` -pg levelset_method.c -o levelset_method | |
Usage: | |
./levelset_method imagefile | |
TODO: | |
・高速化 |