Skip to content

Instantly share code, notes, and snippets.

View shyouhei's full-sized avatar

卜部昌平 shyouhei

View GitHub Profile
require 'benchmark'
a = Array.new(4096) { [rand(1 << 64), rand(1 << 64)] }
n = 1 << 32
Benchmark.bmbm do |x|
x.report do
a.collect do |b|
a.select do |c|
n >= Math.sqrt(
(b[0] - c[0]) ** 2 + (b[1] - c[1]) ** 2
)
diff --git a/tengine_resource/tengine_resource.gemspec b/tengine_resource/tengine_resource.gemspec
index 7730e17..fb205d1 100644
--- a/tengine_resource/tengine_resource.gemspec
+++ b/tengine_resource/tengine_resource.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["taigou", "totty", "g-morita", "shyouhei", "akm", "hiroshinakao"]
- s.date = "2012-05-02"
+ s.date = "2012-05-23"

本年もRubyConfに行っていただきたく思います。

趣意

まあ前回と同じなのですけれども、それだけだとアレなので、繰り返させていただきますが、基本となるのはやはりRubyConfというカンファレンスがとてもよいカンファレンスだということです。RubyConfは「驚くほど同じだし、驚くほど違います」。同じ部分に関して言えば、RubyConfは海外のカンファレンスがどうとか以前の問題として、Rubyのカンファレンスなのです。ようするにおまえらは多少住む大陸が違った程度ではやっぱりおまえらということです。しかし違うところは違う。その違いを、ここで言葉で説明するのはたやすいが、私としてはぜひ皆さん自身の体験としてそれを得てほしいと思っているのです。なぜなら、体験することではじめて得られる部分があるからです。発表スライドや発表動画なら、こんにちインターネット経由でいくらでも入手可能です。それらは、無論、とても良いものですが、かといってそれだけではカンファレンスとして成立しないのも、お分かりかと思います。ぜひ、本物のRubyConfを体験してほしいし、RubyConfにはそれだけの価値はある、と信じています。

お金のこと

今年も卜部が全額負担する予定です。

zsh % rbenv install 2.0.0-dev
/home/shyouhei/.rbenv/plugins/ruby-build/bin/rbenv-install: line 66: rbenv-hooks: command not found
Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /home/shyouhei/.rbenv/versions/2.0.0-dev
Cloning https://github.com/ruby/ruby.git...
Installing ruby-2.0.0-dev...
BUILD FAILED
# -*- coding: utf-8 -*- # Unicode UTF-8エンコーディングを指定する
# マルチバイトの乗算記号を含む文字列リテラル
s = "2×2=4"
# 文字列には5文字をエンコードする6バイトが含まれている
s.bytesize # => 6
s.bytesize.times {|i| print s.getbyte(i), " "} # "50 195 151 50 61 52"と表示
s.length # => 5
s.length.times {|i| print s[i], " "} # "2 × 2 = 4"と表示
@shyouhei
shyouhei / result
Last active December 16, 2015 21:29
これだからPerlは…
zsh % carton exec perl tmp.pl
$VAR1 = {
'1.79769313486232e+308' => '1.79769313486232e+308'
};
$VAR2 = {
'1.79769313486232e+308' => 'inf'
};
zsh % bundle exec ruby tmp.rb
{1.7976931348623157e+308=>1.7976931348623157e+308}
{"1.7976931348623157e+308"=>1.7976931348623157e+308}
#! /your/favourite/path/to/ruby
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
zsh % bzip2 -d ruby-2.0.0-p195.tar.bz2 [2013/Aug/06(Tue) 20:55:30 JST][shyouhei][X121e][pts/7][screen 0]
bzip2: Data integrity error when decompressing.
Input file = ruby-2.0.0-p195.tar.bz2, output file = ruby-2.0.0-p195.tar
It is possible that the compressed file(s) have become corrupted.
You can use the -tvv option to test integrity of such files.
You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.
[
["ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p383.tar.gz", "4f49544d4a4d0d34e9d86c41e853db2e"]
["ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p420.tar.gz", "ca1eee44f842e93b5098bc5a2bb9a40b"]
["ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p249.tar.gz", "d7db7763cffad279952eb7e9bbfc221c"]
["ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p302.tar.gz", "f446550dfde0d8162a6ed8d5a38b3ac2"]
["ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p334.tar.gz", "aacb6ee5dfe2367682bba56af7f415b8"]
["ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p352.tar.gz", "0c33f663a10a540ea65677bb755e57a7"]
["ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p357.tar.gz", "b2b8248ff5097cfd629f5b9768d1df82"]
["ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p358.tar.gz", "26bd55358847459a7752acdbd33a535f"]
["ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p370.tar.gz", "98b00bbd1cdde3116155edb6e555b781"]