This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# glyph-liner.rb : Glyph drawer | |
# by takehikom | |
# ImageMagick's "convert" command is required. | |
class GlyphLiner | |
def initialize(param) | |
@side = 320 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# gfsupport.rb : Member generator for trigonal human pyramids | |
# by takehikom | |
class GFSupport | |
def initialize(lev) | |
@level = lev.to_i | |
raise if @level < 2 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# gen.rb : Generator finder | |
# by takehikom | |
require "openssl" | |
def find_all_generator(p) | |
unless p.to_bn.prime? | |
puts "#{p} is not prime." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# balancing.rb : Divide amount equally using pairwise equalization | |
# by takehikom | |
class Balancing | |
def initialize(n_, rep_ = 5) | |
@n = n_ | |
@rep = rep_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# prorate.rb by takehikom | |
$show_midflow = true | |
class Array | |
def prorate(alloc = 100, permit_float = false) | |
s = self.inject(:+) | |
return self.dup if s == alloc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# kanji_checker2017.rb by takehikom | |
class KanjiChecker | |
def initialize | |
@allocation_new = [nil] | |
@allocation_old = [nil] | |
@kanji2grade_new = {} | |
@kanji2grade_old = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -f $HOME/.java_home ] | |
then | |
export JAVA_HOME=$(cat $HOME/.java_home) | |
elif (\ls -1 $C/Program\ Files/Java | grep -q jdk) | |
then | |
export JAVA_HOME="$C/Program Files/Java/$(\ls -1 $C/Program\ Files/Java | grep jdk | tail -n 1)" | |
echo $JAVA_HOME > $HOME/.java_home | |
fi | |
if [ ${+JAVA_HOME} = 1 ] && [ -d $JAVA_HOME ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# number-line-drawer.rb by takehikom | |
# ruby number-line-drawer.rb | |
# env FN=TakaoGothic.ttf ruby number-line-drawer.rb | |
# 要ImageMagick(convertおよびidentifyコマンドを使用) | |
$FN = ENV['FN'] # フォントのパス | |
$SPC = 20 # 数直線の目盛り幅 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# tomin.rb by takehikom | |
# 「都民ファースト」に似た響きの文字列を生成する | |
require "open-uri" | |
require "zlib" | |
require "stringio" | |
require "kconv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# arrays-2008-2017.bash : 『小学校学習指導要領解説算数編』のアレイ図比較画像作成 | |
# by takehikom | |
# 使用するコマンド:wget, convert (ImageMagick), unzip | |
# コマンド中の日本語文字にも注意 | |
# 『小学校学習指導要領解説算数編』(平成20年)からアレイ図を取り出す | |
if [ ! -f 2008a.pdf ] |