Skip to content

Instantly share code, notes, and snippets.

View komasaru's full-sized avatar

mk-mode komasaru

View GitHub Profile
@komasaru
komasaru / japan_okinawa.R
Created November 25, 2014 07:46
R scirpt to draw a map of Japan. (Okianwa Division Ver.)
# ----------------------------------------
# R scirpt to draw a map of Japan. (Okianwa Division Ver.)
# ----------------------------------------
# ライブラリの読み込み
library(gpclib)
library(ggplot2)
library(maptools)
# ----------------------------------------
print("**** 各種設定")
@komasaru
komasaru / json_stream.rb
Last active August 29, 2015 14:10
Ruby script to get tweet statuses by twitter-stream gem library.
#! /usr/local/bin/ruby
# coding: utf-8
#
# Ruby script to get tweet statuses by twitter-stream gem library.
#
require 'json'
require 'twitter/json_stream'
# Twitter OAuth keys
CONS_KEY = "<your_consumer_key>"
@komasaru
komasaru / ts_test.rb
Last active August 29, 2015 14:10
Ruby script to get tweet statuses by tweetstream library.
#! /usr/local/bin/ruby
# coding: utf-8
# ---------------------------------------------------------
# Ruby script to get tweet statuses by tweetstream library.
# ---------------------------------------------------------
#
require 'tweetstream'
# Twitter OAuth keys ( from environment variables )
CONS_KEY = ENV['TW_CONS_KEY']
@komasaru
komasaru / check_twitter_accounts.rb
Created December 7, 2014 04:30
Ruby script to check existance of twitter accounts.
#! /usr/local/bin/ruby
# coding: utf-8
#= Twitter アカウント登録済みチェック
#
# date name version
# 2014.12.07 mk-mode.com 1.00 新規作成
#
# Copyright(C) 2014 mk-mode.com All Rights Reserved.
#---------------------------------------------------------------------------------
# 引数 : なし
@komasaru
komasaru / check_html.rb
Last active August 29, 2015 14:11
Ruby script to check a difference between a saved-html and a current-html.
#! /usr/local/bin/ruby
# coding: utf-8
#= Checking HTML difference
#
# date name version
# 2014.12.11 mk-mode 1.00 新規作成
#
# Copyright(C) 2014 mk-mode.com All Rights Reserved.
#---------------------------------------------------------------------------------
# 引数 : なし
@komasaru
komasaru / prime_number_2.rb
Created December 15, 2014 05:06
Ruby script to calculate Xth prime number.
#! /usr/local/bin/ruby
# coding: utf-8
# --------------------------------------
# Calculate Xth prime number
# --------------------------------------
class PrimeNumber2
def exec(no)
n, i = 2, 0
loop do
@komasaru
komasaru / prime_number_list.rb
Last active August 29, 2015 14:11
Ruby script to list prime numbers.
#! /usr/local/bin/ruby
# coding: utf-8
# --------------------------------------
# Prime numbers list
# --------------------------------------
class PrimeNumber
def exec(nums)
(1..nums).each do |n|
puts "#{n}: #{is_prime(n) ? 'PRIME' : '----- '}"
@komasaru
komasaru / JAPAN_ETOPO1.sh
Last active August 29, 2015 14:11
Bash script to paint a map with elevation data.
#! /bin/bash
# 各種定数
GRD_SRC="ETOPO1_Bed_g_gmt4.grd"
F_NAME="JAPAN_ETOPO1"
RANGE=126/149/25/46
SIZE=12c
# 用紙サイズ
gmtset PS_MEDIA = Custom_18cx20c
@komasaru
komasaru / twitter_settings.rb
Created January 10, 2015 09:53
Ruby script to set informations of a twitter account.
#! /usr/local/bin/ruby
# coding: utf-8
#
# ========================
# Twitter settings
# ========================
#
require 'twitter'
require 'oauth'
@komasaru
komasaru / geo_ruby_geometry.rb
Created March 20, 2015 07:43
Ruby script to read geometric datas from shapefile.
#! /usr/local/bin/ruby
# coding: utf-8
#*********************************************
# Ruby script to read geometric datas from shapefile.
#*********************************************
#
require 'georuby'
require 'geo_ruby/shp'
include GeoRuby::Shp4r