Skip to content

Instantly share code, notes, and snippets.

View xtetsuji's full-sized avatar

OGATA Tetsuji xtetsuji

View GitHub Profile
@xtetsuji
xtetsuji / gist:3845483
Created October 6, 2012 17:02
Support Maekfile of donwloading and extracting Japanese zipcode database "KEN_ALL".
# -*- makefile -*-
# 2012/08/15
KEN_ALL_ZIP_URL = http://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip
usage:
@echo "Usage:"
@echo " make ken_all.zip"
@echo " make KEN_ALL.CSV"
@xtetsuji
xtetsuji / dump-timetable-2012-11.pl
Created October 22, 2012 07:02
Dump timetable of September 2012 by UTF-8 Japanese format.
#!/usr/bin/perl
# Dump timetable of September 2012 by UTF-8 Japanese format.
use strict;
use warnings;
use utf8;
use Time::Piece;
use Time::Seconds;
binmode STDOUT, ':utf8';
@xtetsuji
xtetsuji / perl-power-bench.pl
Created January 13, 2013 13:54
Perl power operator (**) benchmark. Especially, compare 2-powered with same-values-times. see: https://twitter.com/tooooooooomy/status/290368608213794816 (en: In perl square caluration, same-values-times calcration is fast rather than 2-powered caluration. It is a small piece of knowledge.)
#!/usr/bin/perl
# xtetsuji 2013/01/13
use strict;
use warnings;
use Benchmark;
my $count = 50_000_000;
@xtetsuji
xtetsuji / kt5-ranking.pl
Created January 14, 2013 04:04
キティラーファイブオーディションの中間結果集計スクリプト。2013年1月16日12時まで。投票数は正規の方法で閲覧可能なので、それをゆっくり取得して順位形式として22人を一覧表示するようにした。 see: http://www.with-kitty.com/special/yomecolle_vote/
#!/usr/bin/env perl
# xtetsuji 2013/01/14
# 22人いる
# 最初の猫村いろはは
# http://www.pentatoys.com/vote2/posts/view/7206/?guid=ON
# 最後のは
# http://www.pentatoys.com/vote2/posts/view/7227/?guid=ON
# 特徴ある文字列を正規表現で拾えばよさそう
@xtetsuji
xtetsuji / solve-3x3sudoku.pl
Created February 12, 2013 14:25
3x3 sudoku solves
#!/usr/bin/perl
# solve-3x3sudoku.pl - solve 3x3 sudoku.
# at 2013/02/12 by @xtetsuji
use strict;
use warnings;
use Pod::Usage 'pod2usage';
use constant DEBUG => $ENV{DEBUG};
@xtetsuji
xtetsuji / modperl-data-demo.pl
Created February 24, 2013 05:34
Tiny proof of concept script why mod_perl Registry/PerlRun script can not use __DATA__ (and __END__) token.
#!/usr/bin/perl
# Tiny proof of concept script
# why mod_perl Registry/PerlRun script can not use __DATA__ (and __END__) token.
use strict;
use warnings;
my $code_simple = <<END_CODE;
print "Hello! world1.\n";
END_CODE
@xtetsuji
xtetsuji / benchmark-strip-ext.pl
Created March 19, 2013 08:25
Perl one of benchmark, strip ".html" extension from URL.
#!/usr/bin/perl
use strict;
use warnings;
use Benchmark;
use File::Basename qw(fileparse);
my $URL = 'http://www.example.jp/path/to/foo.html';
my $EXT = '.html';
@xtetsuji
xtetsuji / mac-pasteboard-bug.pl
Last active December 16, 2015 06:10
Mac::Pasteboard (Version 0.0004) can not handling multibyte UTF-8 characters.
#!/usr/bin/env perl
# This document is UTF-8
use strict;
use warnings;
use bytes; # UTF-8 bytestream
use Mac::Pasteboard;
my $snowman = "☃☃☃";
@xtetsuji
xtetsuji / ae-irc-skeleton.pl
Last active December 17, 2015 07:58
Using AnyEvent::IRC::Client code skeleton.
#!/usr/bin/env perl
# Writte by OGATA Tetsuji at 2013/05/14
use strict;
use warnings;
use utf8;
use AnyEvent;
use AnyEvent::IRC::Client;
use Encode;
@xtetsuji
xtetsuji / markline-off.pl
Created May 31, 2013 07:19
"Markline", perl interepreter's magic comment(?), concept code.
#!/usr/bin/perl
use strict;
use warnings;
# ordinally comment.
sub foo {
print "foo\n";
}