Skip to content

Instantly share code, notes, and snippets.

@takehiko
takehiko / gf-20190611.rb
Created June 10, 2019 21:01
ワントップでないピラミッドの荷重計算
#!/usr/bin/env ruby
# gf-20190611.rb : ワントップでないピラミッドの荷重計算
# by takehikom
# git clone https://github.com/takehiko/gf.git
# ruby gf-20190611.rb
# gem install rubyXL
# ruby gf-20190611.rb -e
# ls -l gf1.xlsx gf1a.xlsx gf2.xlsx gf3.xlsx
@takehiko
takehiko / waza.rb
Created June 14, 2019 21:08
組体操の2冊の本からの技調査
#!/usr/bin/env ruby
# waza.rb : 組体操の2冊の本からの技調査
# by takehikom
def waza_key(w, indent = 0)
" " * indent + w[2] + "(#{w[3]}人技)"
end
waza2014 = []
@takehiko
takehiko / quadrilateral-drawer.rb
Created September 7, 2019 03:08
Quadrilateral shape decider and drawer
#!/usr/bin/env ruby
# quadrilateral-drawer.rb : Quadrilateral shape decider and drawer
# by takehikom
# This program invokes ImageMagick's "convert" command.
class QuadrilateralDrawer
def initialize(opt = {})
@margin = (opt[:margin] || 10).to_i
@takehiko
takehiko / dotcircle.rb
Created November 10, 2019 20:27
Drawing circles connecting four points
#!/usr/bin/env ruby
# dotcircle.rb : Drawing circles connecting four points
# by takehikom
# This program invokes ImageMagick's "convert" command.
class DotcircleDrawer
def initialize
@bgcolor = "#f0fff0"
@takehiko
takehiko / iidxum-extractor.rb
Last active December 9, 2019 20:45
Free song extractor for beatmania IIDX ULTIMATE MOBILE
#!/usr/bin/env ruby
require "kconv"
# iidxum-extractor.rb : Free song extractor for beatmania IIDX ULTIMATE MOBILE
# by takehikom
# see also: https://takehikom.hateblo.jp/entry/2019/12/10/000000
# beatmania IIDX ULTIMATE MOBILEの楽曲一覧
# (https://p.eagate.573.jp/game/2dx/mobile/music/game.html?game_id=27.0 など)
@takehiko
takehiko / iidxum-versionpicker.rb
Last active December 9, 2019 20:48
Version extractor for beatmania IIDX ULTIMATE MOBILE
#!/usr/bin/env ruby
require "kconv"
# iidxum-versionpicker.rb : Version extractor for beatmania IIDX ULTIMATE MOBILE
# by takehikom
# see also: https://takehikom.hateblo.jp/entry/2019/12/10/000000
# 通信せず、27.0(という名前)のファイルを読み出して、
# game_idの値とバージョン名を見つけ、カンマ区切りで出力する
@takehiko
takehiko / foureights.rb
Last active January 11, 2020 01:28
Four-8 Puzzle
#!/usr/bin/env ruby
# foureights.rb : "8-((8+8)/8)" Puzzle
# by takehikom
# see also: https://takehikom.hateblo.jp/entry/2020/01/11/062120
# 環境変数LANGの値がja_JP.UTF-8などのときは,
# 日本語文字で出力する(実行時オプションで変更可能)
$option_zenkaku = /jp/i === ENV["LANG"]
@takehiko
takehiko / paapi5search.js
Last active March 14, 2020 05:39
Product search using PA-API v5
// paapi5search.js - Product search using PA-API v5
// by takehikom
// npm install paapi5-nodejs-sdk
// npm install optparse
// npm install bitly
// node search.js 'Harry Potter'
// node search.js 9784791628889
// node search.js -t 9784393376034 -j
@takehiko
takehiko / radicalfinder.rb
Created April 9, 2020 12:42
MJ文字情報から,部首と同じ字形の漢字を求める
#!/usr/bin/env ruby
# radicalfinder.rb : 部首と同じ字形の漢字を求める
# by takehikom
require "roo" # gem install roo
class Radicalfinder
def initialize(opt = {})
@opt_kyoikukanji_only = opt[:kyoiku]
@takehiko
takehiko / insert-timestamp.el
Created February 17, 2021 13:29
Functions for inserting a timestamp in several different ways on Emacs
;; M-x insert-timestamp-default (またはM-x its)で Wed Feb 17 22:18:46 2021
;; M-x insert-timestamp-htmlcomment (またはM-x itsh)で <!-- 2021-02-17 22:18:52 +09:00 --> (と改行)
;; M-x insert-timestamp-unixtime (またはM-x itsu)で 1613567937
;; M-x insert-timestamp-iso (またはM-x itsi)で 2021-02-17T22:19:01+09:00
(defun insert-timestamp-default ()
"Insert the current timestamp"
(interactive)
(insert (current-time-string)))
(defalias 'its 'insert-timestamp-default)