Skip to content

Instantly share code, notes, and snippets.

View isseium's full-sized avatar
🎯
Focusing

Komatsu Issei isseium

🎯
Focusing
View GitHub Profile
@isseium
isseium / gist:7908089
Created December 11, 2013 10:20
大学時間割調整用
"月火水木金".split('').each do |w|
[1, 2, 3, 4, 5, '放'].each do |t|
puts w + t.to_s
end
end

OK

こんな感じに、

  • trivial warning が出力されない
  • 全部 ok

になればOKです。

@isseium
isseium / gist:5822504
Last active September 17, 2021 03:45
rspec の include で hash 構造をチェックするテスト
describe "Rspec include test" do
it "include" do
hash = {:a => 'A', :b => 'B', :c => { :ca => 'CA' }}
expect(hash).to include(:c => {:ca => 'CA'}); #
expect(hash).to include(:a => 'A', :c => {:ca => 'CA'}); # ならべてもいいっぽい
expect(hash).to_not include(:ca => 'CA'); # ちゃんと構造みてくれる
expect(hash).to include(:a); # キーだけでもOK
expect(hash).to_not include(:d); # キーだけでもOK
end
end
@isseium
isseium / find_best_response.sh
Last active December 18, 2015 05:39
WiMAXルーターをどこに置けばよいか探すために作成. 1秒間に1回pingにてレスポンスタイムを取得し,これまで(擬似的な平均値)より品質がよいときは,ビープ音を変化させて知らせる.
#/bin/bash
avg=0
host="yahoo.co.jp"
while(true)
do
# ping から レスポンスタイム を取得
rtt=$(ping -c 1 $host | head -2 | tail -1 | sed 's/.*time=\(.*\) ms$/\1/g' | sed 's/\..*$//')
echo $rtt