Geography::JapaneseMunicipals

Geography::JapanesePrefecturesの市区町村版みたいなGeography::JapaneseMunicipalsを作った。
近々、CPANにうpしようかと。

use strict;
use warnings;
use utf8;

use FindBin::libs;
use Geography::JapaneseMunicipals;
use YAML;

binmode STDOUT, ':encoding(sjis)';

my $name = '東京都渋谷区';
my $id = Geography::JapaneseMunicipals->municipal_id($name);
print "$name -> $id\n";
# 東京都渋谷区 -> 13113

$id = '01202';
$name = Geography::JapaneseMunicipals->municipal_name($id);
print "$id -> $name\n";
# 01202 -> 函館市

my $municipals = Geography::JapaneseMunicipals->municipal_infos('東京都');
print Dump $municipals;
# ---
# - id: 13101
#   name: 千代田区
#   prefecture:
#     id: 13
#     name: 東京都
#   region:
#     name: 関東
# 
# ...
# 
# - id: 13421
#   name: 小笠原村
#   prefecture:
#     id: 13
#     name: 東京都
#   region:
#     name: 関東

WWW::PASMO

http://www.pasmo.co.jp/useful/mypage.htmlスクレイピングするモジュールWWW::PASMOを作ってとりあえずコミッた。

use strict;
use warnings;

use WWW::PASMO;
use YAML;

my $pasmo = WWW::PASMO->new;
die "faild to login"
    unless $pasmo->login('your id', 'your pswd');

print Dump $pasmo->history();
[h@lily]% perl pasmo.pl     
---
histories:
  - balance: 330
    date: 02/01
    info1:
      kind: 入
      station: 旗の台
    info2:
      kind: 出
      station: 自由が丘
  - balance: 480
    date: 01/31
    info1:
      kind: 入
      station: 東急五反
    info2:
      kind: 出
      station: 旗の台
...
  - balance: 1230
    date: 01/27
    info1:
      kind: カード
      station: 富士見台
    info2:
      kind: ''
      station: ''
...
  - balance: 1070
    date: 01/25
    info1:
      kind: 現金
      station: 富士見台
    info2:
      kind: ''
      station: ''
[h@lily]% 

東急五反って…。駅名からジオコーディングしてあれこれしたかったのだけどな。

ISBNScraper

これ使えば巷にあふれる Amazon 系グリモンとかいろんなサイトに対応できるよ、きっと。
めんどいので詳細はコード見て想像してください。前に書いたのをちょっときれいにしただけだけど。

// ==UserScript==
// @name           isbntest
// @namespace      http://d.hatena.ne.jp/hetappi
// @include        http://www.google.co.jp/*
// @require        http://isbnjs.googlecode.com/svn/trunk/isbn.js
// @require        http://isbnjs.googlecode.com/svn/trunk/isbn-groups.js
// @require        http://svn.coderepos.org/share/lang/javascript/userscripts/GM_Libs/hetappi/gmutils.js
// @require        http://svn.coderepos.org/share/lang/javascript/userscripts/GM_Libs/hetappi/isbnscraper.js
// ==/UserScript==

(function() {
    var scraper = new ISBNScraper();
///    scraper.awsKeyId = '12345678901234567890';
    scraper.scrape('http://www.7andy.jp/books/detail/-/accd/R0349944', function(isbn, book) {
        console.log(isbn.asIsbn13(1));
        if (book) {
            console.log(book.author);
            console.log(book.title);
            console.log(book.manufacturer);
        }
    });
})();

今年は痩せる

お腹があやしくなってきたので体重計を買った。そんだけ。

オムロン 体重体組成計 カラダスキャン  HBF-370-Y

オムロン 体重体組成計 カラダスキャン HBF-370-Y