Skip to content

Instantly share code, notes, and snippets.

Avatar

SHIMADA Koji snoozer05

View GitHub Profile
@snoozer05
snoozer05 / gist:ca9860c57683e4221d10
Last active Aug 29, 2015
Ruby commit count until 2.1.0-p0
View gist:ca9860c57683e4221d10
* 1: nobu 1870
* 2: akr 716
* 3: nagachika 488
* 4: svn 449
* 5: ko1 423
* 6: naruse 339
* 7: zzak 290
* 8: usa 276
* 9: kazu 149
* 10: drbrain 114
@snoozer05
snoozer05 / gist:1477002
Created Dec 14, 2011
sumim さんのボウリング集計のコード(http://d.hatena.ne.jp/sumim/20111214/p1)を Ruby で
View gist:1477002
def score1(pins)
cursor = 0
frame_points = []
9.times do
frame_points << pins[cursor, 3]
cursor += 2
if frame_points.last.first == 10
cursor -= 1
else
if frame_points.last.take(2).inject(:+) != 10
View pcap.rb
#!/usr/bin/ruby
require 'pcap'
def cap_data(dev,filstr,count)
# [device],[snaplen],[promisc?],[read timeout(ms)]
pcaplet = Pcap::Capture.open_live(dev,1460,true,1000)
access = Pcap::Filter.new(filstr,pcaplet)
pcaplet.setfilter(access)
View twJVN.rb
#! /usr/bin/ruby
require "rubygems"
require 'oauth'
require 'rubytter'
require 'rss/1.0'
require 'open-uri'
# 設定ファイルをロードする