Skip to content

Instantly share code, notes, and snippets.

View makimoto's full-sized avatar
😪

Shimpei Makimoto makimoto

😪
View GitHub Profile
#!/usr/bin/env python
# vim:fileencoding=utf-8
# lv_presentation_gen.py - lv presentation generator
from optparse import OptionParser
op = OptionParser()
op.add_option('-s','--separator',dest='sep',help='set page separator',default='----')
op.add_option('-o','--output',dest='output',help='set output directory',default='.')
#!/usr/local/bin/python
# vim:fileencoding=utf8
from json import dumps
from mod_python import apache
import datetime
import qreki
def index(req,**args):
req.content_type = 'text/javascript'
#!/usr/bin/env python
# vim:fileencoding=utf-8
'''
a experiment for Kamogawa Equal-Distance Law
usage:
% kamogawa.py #pairs second_pair_distance
eg.
% kamogawa.py 10 100.0
'''
from sys import argv,stderr
#!/usr/bin/env python
'''
a solver for http://twitter.com/not522/status/16626276702
'''
from sys import argv
from itertools import permutations,product
ops = ['+','-','*','/']
parns = ['', '(', ')' ]
#!/usr/bin/env ruby
# PLSI implement in pure Ruby
# 'foolishly honest' translation from python impl. in http://satomacoto.blogspot.com/2009/10/pythonplsa.html
class PLSI
def initialize(n, nz=2)
# n: Document-Word matrix, nz: # latent variables
@n = n
@nz = nz
#!/usr/env ruby
# vim:fileencoding=utf-8
require "rubygems"
require "mechanize"
id = "[email protected]"
pwd = "password"
agent = Mechanize.new
diff -x .git -Naru rspec.orig/lib/spec/runner/formatter/progress_bar_formatter.rb rspec/lib/spec/runner/formatter/progress_bar_formatter.rb
--- rspec.orig/lib/spec/runner/formatter/progress_bar_formatter.rb 2010-10-15 11:55:45.000000000 +0900
+++ rspec/lib/spec/runner/formatter/progress_bar_formatter.rb 2010-10-15 11:52:21.000000000 +0900
@@ -8,18 +8,18 @@
include NOOPMethodMissing
def example_failed(example, counter, failure)
- @output.print colorize_failure('F', failure)
+ @output.print colorize_failure('\(^o^)/', failure)
@output.flush
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'haml'
require 'json'
get '/' do
@title = 'Presentation'
haml :index
end
#!/usr/bin/env ruby
# vim:fileencoding=utf-8
require 'open-uri'
(100...1000).each do |i|
sleep 1
x = open("http://pbh.jp/#{i}/") rescue next
puts i
end
Common subdirectories: elastic-mapreduce-ruby/amazon and elastic-mapreduce-ruby-multiple-jobconf/amazon
diff -cN elastic-mapreduce-ruby/commands.rb elastic-mapreduce-ruby-multiple-jobconf/commands.rb
*** elastic-mapreduce-ruby/commands.rb 2011-02-14 14:35:14.000000000 +0900
--- elastic-mapreduce-ruby-multiple-jobconf/commands.rb 2011-02-23 10:01:37.000000000 +0900
***************
*** 525,531 ****
end
for jc in get_field(:jobconf, []) do
! stream_options << "-jobconf" << jc