Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
=begin
This script was written by Takashi SUGA on January 2017-November 2019
You may use and/or modify this file according to the license described in the MIT LICENSE.txt file https://raw.githubusercontent.com/suchowan/watson-api-client/master/LICENSE.
=end
require 'open-uri'
require 'openssl'
require 'json'
@suchowan
suchowan / range.rb
Last active December 24, 2022 04:09
# -*- coding: utf-8 -*-
=begin
This script was written by Takashi SUGA on July 2017 - December 2022
You may use and/or modify this file according to the license described in the MIT LICENSE.txt file
https://raw.githubusercontent.com/suchowan/watson-api-client/master/LICENSE.
See also https://suchowan.seesaa.net/article/202212article_25.html
=end
require 'pp'
@suchowan
suchowan / anomaly_lines.rb
Created October 30, 2019 01:04
「中心差にみる重修大明暦と授時暦の類似性」のためのPCA処理スクリプト
# -*- coding: utf-8 -*-
=begin
Copyright (C) 2015-2019 Takashi SUGA
You may use and/or modify this file according to the license
described in the LICENSE.txt file included in https://github.com/suchowan/when_exe.
=end
#
# 中心差にみる重修大明暦と授時暦の類似性
@suchowan
suchowan / duration.rb
Created May 17, 2021 02:32
Refinement example for when_exe gem
# -*- coding: utf-8 -*-
=begin
Copyright (C) 2013-2021 Takashi SUGA
You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
=end
#
# When::TM::Duration のための標準クラスの拡張
#
@suchowan
suchowan / perm.rb
Created June 21, 2021 02:30
勝敗経緯パターンの試行
module Static
refine Array do
# 平均
def mean
self.inject(&:+) / self.length
end
# 標準偏差
def sdev
m = self.mean
@suchowan
suchowan / check_kansei_calendar.rb
Created August 6, 2021 00:03
寛政暦時代二十四節気日時の確認
# -*- coding: utf-8 -*-
=begin
寛政暦時代の二十四節気日時の確認
参考 https://eco.mtk.nao.ac.jp/koyomi/wiki/BEC3C4B9CBA1.html
寛政暦では暦定数を10年ごとに更新するので、まず10年目ごとの
天正冬至の日時を正確に計算し、すべての二十四節気は、その間
@suchowan
suchowan / mlb_rating.rb
Last active November 3, 2023 21:50
MLB 2023 season rating calculation
#require 'pp'
require 'open-uri'
require 'openssl'
require 'matrix'
Encoding.default_external = 'UTF-8'
Encoding.default_internal = 'UTF-8'
#######################################
##
require 'pp'
require 'when_exe'
include When
=begin
check script for https://suchowan.seesaa.net/article/201208article_19.html
=end
t1 = [1, 2].map {|n|
Ephemeris.root(23*n, 0) {|t|