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
## Download the pdf files of Ubuntu Magazine Japanese vol.3 | |
## (URL http://ubuntu.asciimw.jp/elem/000/000/010/10231/) | |
require 'open-uri' | |
BASE_URL = 'http://ubuntu.asciimw.jp/elem/000/000/010/10231/' | |
PDF_URL_REG = /href="(koukai\/.+?.pdf)"/ | |
OUT_DIR = 'ubumaga_vol3' | |
html_body = '' | |
open(BASE_URL, 'r') { |f| html_body = f.read } |
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
/* | |
itunes_conv.js - iTunesの曲名を変換するスクリプト(Windows用) | |
[使い方] | |
(1) iTunesを開く | |
(2) 変換したい曲を選択(複数選択可) | |
(3) このスクリプトを実行(ファイルをダブルクリック | |
or コマンドプロンプトで wscript itunes_conv.js) | |
[参考] | |
http://www1.atwiki.jp/itunes/pages/26.html | |
http://d.hatena.ne.jp/prime503/20090914/1252883786 |
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
/* | |
TextFieldとMinimalCompsのVScrollBarで手っ取り早く | |
日本語が使えるスクロールバー付きTextFieldを作るサンプル | |
(MinimalCompsのTextAreaのソースコードを参考にしています) | |
*/ | |
package { | |
import flash.display.Sprite; | |
import flash.text.TextField; | |
import flash.text.TextFieldType; | |
import flash.events.Event; |
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
/* | |
CSV to Array using #include | |
*/ | |
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
/* echo '10,20,30,40,50' > hoge.csv */ | |
int hoge[] = { |
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: | |
・高速化 |
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
#!/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
# 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
# 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) | |
# |