I hereby claim:
- I am tonytonyjan on github.
- I am tonytonyjan (https://keybase.io/tonytonyjan) on keybase.
- I have a public key whose fingerprint is F30B 53C9 A9CC B71C A034 4E2A 055A F90B C74E 4F4C
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| require 'benchmark' | |
| require 'id_check' | |
| require 'taiwanese_id_builder' | |
| require 'TaiwanUserID' | |
| n = 100000 | |
| Benchmark.bmbm do |x| | |
| x.report('wayne5540 '){ n.times{ TaiwaneseIdBuilder.valid?('A123456789') } } | |
| dummy = Object.new.extend(TaiwanUserID) | |
| x.report('kaochenlong'){ n.times{ dummy.is_valid?('A123456789') } } |
| # ~/.config/fish/functions/fish_prompt.fish | |
| set -g __fish_git_prompt_show_informative_status 1 | |
| set -g __fish_git_prompt_hide_untrackedfiles 1 | |
| set -g __fish_git_prompt_color_branch magenta bold | |
| set -g __fish_git_prompt_showupstream "informative" | |
| set -g __fish_git_prompt_char_upstream_ahead "↑" | |
| set -g __fish_git_prompt_char_upstream_behind "↓" | |
| set -g __fish_git_prompt_char_upstream_prefix "" |
| #include <stdio.h> | |
| #define SWAP(a,b) do{ typeof(a) tmp = a; a = b; b = tmp; }while(0) | |
| void permutate(int* v, int n, int i) { | |
| int j; | |
| if (i == n) { | |
| for(j = 0; j < n; j++) printf("%d ", v[j]); | |
| printf("\n"); | |
| }else | |
| for(int j = i; j < n; j++) { |
| #!/usr/local/bin/expect -f | |
| set timeout 60 | |
| log_file -noappend $env(HOME)/log/ptt.log | |
| spawn ssh -o "StrictHostKeyChecking no" [email protected] | |
| expect "new" | |
| send "$env(PTT_ID)\r" | |
| expect ":" | |
| send "$env(PTT_PWD)\r" | |
| expect { | |
| "您想刪除其他重複登入的連線嗎" { |
*.gemspec,並取得 gem name。| #!/usr/bin/env ruby | |
| # frozen-string-literal: true | |
| 平仮名 = { | |
| 清音: {'あ' => 'a', 'か' => 'ka', 'さ' => 'sa', 'た' => 'ta', 'な' => 'na', 'は' => 'ha', 'ま' => 'ma', 'や' => 'ya', 'ら' => 'ra', 'わ' => 'wa', 'い' => 'i', 'き' => 'ki', 'し' => 'shi', 'ち' => 'chi', 'に' => 'ni', 'ひ' => 'hi', 'み' => 'mi', 'り' => 'ri', 'う' => 'u', 'く' => 'ku', 'す' => 'su', 'つ' => 'tsu', 'ぬ' => 'nu', 'ふ' => 'fu', 'む' => 'mu', 'ゆ' => 'yu', 'る' => 'ru', 'ん' => 'n', 'え' => 'e', 'け' => 'ke', 'せ' => 'se', 'て' => 'te', 'ね' => 'ne', 'へ' => 'he', 'め' => 'me', 'れ' => 're', 'お' => 'o', 'こ' => 'ko', 'そ' => 'so', 'と' => 'to', 'の' => 'no', 'ほ' => 'ho', 'も' => 'mo', 'よ' => 'yo', 'ろ' => 'ro', 'を' => 'o'}, | |
| 濁音: {'が' => 'ga', 'ざ' => 'za', 'だ' => 'da', 'ば' => 'ba', 'ぱ' => 'pa', 'ぎ' => 'gi', 'じ' => 'ji', 'ぢ' => 'ji', 'び' => 'bi', 'ぴ' => 'pi', 'ぐ' => 'gu', 'ず' => 'zu', 'づ' => 'zu', 'ぶ' => 'bu', 'ぷ' => 'pu', 'げ' => 'ge', 'ぜ' => 'ze', 'で' => 'de', 'べ' => 'be', 'ぺ' => 'pe', 'ご' => 'go', 'ぞ' => 'zo', 'ど' => 'do', 'ぼ' => 'bo', 'ぽ' => 'po'}, | |
| 拗音: {'きゃ' => 'kya', 'ぎゃ' => |
| answer = 0.upto(9).to_a.sample(4).join | |
| while true | |
| puts 'wrong format, should be 4 digits.' until (guess = gets.chop!) =~ /^\d{4}$/ | |
| a = b = 0 | |
| guess.each_char.each_with_index do |c1, idx1| | |
| answer.each_char.each_with_index do |c2, idx2| | |
| if c1 == c2 | |
| idx1 == idx2 ? a += 1 : b += 1 |
| exit if (level = ARGV[0].to_i) <= 0 | |
| def combination n, r | |
| return 1 if r == 0 | |
| n.downto(n-r+1).inject(:*) / r.downto(1).inject(:*) | |
| end | |
| max_length = combination(level-1, (level-1)/2).to_s.length | |
| ary = [1] | |
| 0.upto(level-1).each do |i| |
| n = ARGV.first.to_i | |
| fact = Hash.new(0) | |
| while match_data = /^(.{2,}?)\1+$/.match('.'*n) | |
| fact[match_data[1].length] += 1 | |
| n /= match_data[1].length | |
| end | |
| fact[n] += 1 | |
| puts fact.sort.map!{|k,v| "#{k}#{"**#{v}" if v > 1}"}.join(' * ') |