This file contains 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 | |
echo -n ! | |
exec git "$@" |
This file contains 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
% convert -trim sozai-big.png sozai-trim.png | |
% identify sozai-trim.png | |
sozai-trim.png PNG 2385x2885 2834x3000+286+115 8-bit sRGB 3.756MB 0.000u 0:00.000 | |
% convert -resize 2300x3000 -gravity south -background white -extent 2300x3000 sozai-trim.png onigiri.jpg |
This file contains 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
body { | |
border-radius: 0px !important; | |
} |
This file contains 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
require 'pp' | |
$KCODE = 'UTF8' | |
module Ngram | |
def run(str) | |
analyze(cut(str,3)) | |
end | |
def cut(str, n) | |
list = str.split(//) |
This file contains 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/ruby | |
# -*- coding: utf-8 -*- | |
# オセロの石を置くプログラム | |
# based on http://bkc.g.hatena.ne.jp/coconutsfine/20081010/1223651539 | |
# 新しい盤面のArrayを作って返す | |
def setup_box | |
# 盤面オブジェクトを生成(8x8の:empty) | |
box = Array.new(8){ Array.new(8, :empty) } | |
#盤面の初期値を設定 |
This file contains 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/ruby | |
def parse(string) | |
string.each_line do |line| | |
list = line.split(" ") | |
print "#{list.first}: " | |
list[1..-1].each do |token| | |
raise "input's size should 2(#{token})" if token.size != 2 | |
token.split("").each do |char| | |
num = char.chomp.hex.to_s(2) | |
print "#{'0'*(4-num.size%4) if num.size%4 != 0}#{num}" |
This file contains 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
* N: NUMBER OF INPUT | |
N: EQU 80H | |
* CUR: CURRENT RESULT (AND RESULT) | |
CUR: EQU 81H | |
* P1: PREVIOUS RESULT | |
P1: EQU 82H | |
* P2: PRE-PREVIOUS RESULT |
This file contains 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
class Stone | |
@@STONE_COLORS = [:white, :black] | |
def initialize(heads_color) | |
raise "Invalid type" unless @@STONE_COLORS.include?(heads_color) | |
@heads = heads_color | |
end | |
attr_reader :heads # 表の色 | |
This file contains 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
LINE = "="*80 | |
Dir.glob("*.cpp\0*.h") do |file| | |
puts LINE | |
puts " " + file | |
puts LINE | |
system("cat -n #{file}") | |
end |
This file contains 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/ruby | |
# -*- coding: utf-8 -*- | |
# マルコフ連鎖をしてみるやつ | |
$KCODE = 'UTF8' | |
# Array::choiseを追加 | |
class Array | |
def choise | |
self[rand(self.size)] |