Skip to content

Instantly share code, notes, and snippets.

mk-mode komasaru

Block or report user

Report or block komasaru

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@komasaru
komasaru / test_nokogiri_xml.rb
Created Aug 28, 2015
Ruby script to verify the speed of xml parsing by Nokogiri.
View test_nokogiri_xml.rb
#! /usr/local/bin/ruby
# coding: utf-8
#
# Ruby script to verify the speed of xml parsing by Nokogiri.
#
# Copyright(C) 2015 mk-mode.com All Rights Reserved.
#---------------------------------------------------------------------------------
#++
require 'benchmark'
require 'nokogiri'
@komasaru
komasaru / iso_3166_2_jp.csv
Created Mar 2, 2014
CSV file of ISO 3166-2:JP.
View iso_3166_2_jp.csv
3166-2 code Subdivision name Language code
JP-01 Hokkaido en
JP-01 Hokkaidô ja
JP-02 Aomori ja
JP-03 Iwate ja
JP-04 Miyagi ja
JP-05 Akita ja
JP-06 Yamagata ja
JP-07 Fukushima en
JP-07 Hukusima ja
@komasaru
komasaru / iso_3166_1.csv
Created Mar 2, 2014
CSV file of ISO 3166-1.
View iso_3166_1.csv
English short name Alpha-2 code Alpha-3 code Numeric
Afghanistan AF AFG 004
Åland Islands AX ALA 248
Albania AL ALB 008
Algeria DZ DZA 012
American Samoa AS ASM 016
Andorra AD AND 020
Angola AO AGO 024
Anguilla AI AIA 660
Antarctica AQ ATA 010
@komasaru
komasaru / read_excel.rb
Created Mar 9, 2014
Ruby script to read a Excel workbook by 'spreadsheet'.
View read_excel.rb
require 'spreadsheet'
XLS = "./test.xls"
class ReadExcel
# 読み込み
def read
begin
# Excelファイルを読み込み
wb = Spreadsheet.open(XLS, 'r')
@komasaru
komasaru / write_excel.rb
Created Mar 9, 2014
Ruby script to write a Excel workbook by 'spreadsheet'.
View write_excel.rb
require 'spreadsheet'
XLS = "./test_2.xls"
class WriteExcel
# 書き込み
def write
begin
# ワークブック生成
wb = Spreadsheet::Workbook.new
@komasaru
komasaru / noaa_stations.rb
Created Mar 17, 2014
Ruby script to calculate a summary of the list of NOAA's weather stations.
View noaa_stations.rb
# ***************************************
# Ruby script to calculate a summary of
# the list of NOAA's weather stations.
# ***************************************
require 'open-uri'
class NoaaStations
FILE = "http://www.aviationweather.gov/static/adds/metars/stations.txt"
def initialize
@komasaru
komasaru / noaa_weather_station.sh
Last active Aug 29, 2015
Bash script to search NOAA weather stations by a ICAO code.
View noaa_weather_station.sh
#!/bin/bash
# 引数(ICAO コード)不正なら終了
if [[ ! "$1" =~ [0-9A-Z]{4} ]]; then
echo "Wrong argument! - $1"
exit
fi
# 定数定義
URL="http://www.aviationweather.gov/static/adds/metars/stations.txt"
@komasaru
komasaru / test_maptools.R
Last active Aug 29, 2015
R script to generate a map by maptools.
View test_maptools.R
# ライブラリの読み込み
library(maptools)
library(RColorBrewer)
# Shape ファイルのフルパス
shp <- '/path/to/shapefile.shp'
# Shape ファイルの読み込み
# map <- readShapePoly(shp) # これでもよい
map <- readShapeSpatial(shp)
@komasaru
komasaru / earthquake.R
Created Jul 27, 2014
R script to plot earthquake infos on a map.
View earthquake.R
# 国土地理院・地球地図日本に地震情報をプロット
# ライブラリの読み込み
library(gpclib)
library(ggplot2)
library(maptools)
# gpclib ライセンス警告表示の抑止
gpclibPermit()
@komasaru
komasaru / test_maptools_ksj.R
Last active Aug 29, 2015
R script to generate a map of KSJ by maptools.
View test_maptools_ksj.R
# ライブラリの読み込み
library(gpclib)
library(ggplot2)
library(maptools)
# gpclib ライセンス警告表示の抑止
gpclibPermit()
# Shape ファイルのフルパス
shp_file <- '/path/to/N03-140401_32_GML/N03-14_32_140401.shp'
You can’t perform that action at this time.