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
97cbab7 (akr 2009-01-17 04:11:27 +0000) /************************************************ | |
97cbab7 (akr 2009-01-17 04:11:27 +0000) | |
97cbab7 (akr 2009-01-17 04:11:27 +0000) ainfo.c - | |
97cbab7 (akr 2009-01-17 04:11:27 +0000) | |
97cbab7 (akr 2009-01-17 04:11:27 +0000) created at: Thu Mar 31 12:21:29 JST 1994 | |
97cbab7 (akr 2009-01-17 04:11:27 +0000) | |
97cbab7 (akr 2009-01-17 04:11:27 +0000) Copyright (C) 1993-2007 Yukihiro Matsumoto | |
97cbab7 (akr 2009-01-17 04:11:27 +0000) | |
97cbab7 (akr |
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
irb(main):022:0> [1, 10, 100, 1000, 100000, 1000000, 10000000].each {|i| p(fib(i) % 1000000) } | |
1 | |
55 | |
915075 | |
228875 | |
746875 | |
546875 | |
546875 | |
=> [1, 10, 100, 1000, 100000, 1000000, 10000000] | |
irb(main):023:0> (3 ** 546875) % 1000000 |
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
def Archimedean_spiral n | |
if n == 0 | |
return [ [ '#' ] ] | |
else | |
inner = Archimedean_spiral(n - 1) | |
length = inner.size | |
ret = [] | |
ret << ([ '#', '#' ] + ([ '#' ] * length) + [ '#', '#' ] ) | |
ret << ([ '#', ' ' ] + ([ ' ' ] * length) + [ ' ', ' ' ] ) | |
inner.each do |x| |
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 = ARGV.first.to_i | |
size = n * 4 + 1 | |
spiral = Array.new(size) { Array.new(size) { ' ' } } | |
def Archimedean_spiral_sequence(n) | |
if n == 0 | |
yield 0, 0 | |
else | |
Archimedean_spiral_sequence(n - 1) do |x, y| | |
yield x + 2, y + 2 |
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
zsh % ~/target/branches/ruby_1_8_6/bin/ruby /home/shyouhei/ruby/branches/ruby_1_8/rubyspec/mspec/bin/mspec-run --background --prefix /home/shyouhei/ruby/branches/ruby_1_8/rubyspec/spec -B /home/shyouhei/ruby/branches/ruby_1_8/rubyspec/spec/ruby.1.8.mspec | |
.........................................F.......................................................................................................F..........................................................................................................................................................................................E.......................................E.........................................E................................................................................................................................................................................................................................................................................................................................................................. |
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
# Copyright(c) 2010 Urabe, Shyouhei. All rights Reserved. | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this code, to deal in the code without restriction, including without | |
# limitation the rights to use, copy, modify, merge, publish, distribute, | |
# sublicense, and/or sell copies of the code, and to permit persons to whom the | |
# code is furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be | |
# included in all copies or substantial portions of the code. |
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 | |
require 'svn/client' | |
require 'tempfile' | |
# (1) get the data | |
file = 'tmp.marshal' | |
dat = nil | |
begin | |
open file, 'rb' do |fp| | |
dat = Marshal.load fp |
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
# -*- coding: utf-8 -*- | |
require 'pathname' | |
s1 = File.dirname(__FILE__) | |
s2 = File.expand_path('ディレクトリ/ファイル', s1) | |
s3 = File.dirname(s2) | |
s4 = File.expand_path(s3) | |
p1 = Pathname(s2) | |
p2 = Pathname(s4) | |
p3 = p2.relative_path_from(p1) |
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
zsh % ruby -ve ' | |
require "fileutils" | |
require "coverage" | |
FileUtils.mkdir_p "ディレクトリ" | |
FileUtils.touch "ディレクトリ/ファイル.rb" | |
$LOAD_PATH << "ディレクトリ" | |
Coverage.start | |
require "ファイル" |
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/ruby1.8.7 -Ku | |
require 'socket' | |
require 'open-uri' | |
require 'time' | |
require 'json' | |
require 'base64' | |
def cut str, len=100 | |
a = str.scan /./u |
OlderNewer