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
$ uname -a | |
Linux yura-desktop 2.6.38-13-generic #54-Ubuntu SMP Tue Jan 3 13:44:52 UTC 2012 i686 athlon i386 GNU/Linux | |
$ rvm -v | |
rvm 1.10.2 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.beginrescueend.com/] | |
$ bash --version | |
GNU bash, версия 4.2.8(1)-release (i686-pc-linux-gnu) | |
Copyright (C) 2011 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> |
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
class String | |
def randchar | |
self[(rand * size).to_i] | |
end | |
end | |
Vowels = 'aeiouy' | |
Consonants = 'bcdfghjklmnpqrstvwxz' | |
VowelsR, ConsonantsR = [Vowels, Consonants].map{|s| /[#{s}]/} | |
Chars = [Vowels, Consonants] | |
def gen_pass(len) |
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
diff --git a/Changelog.backport_gc b/Changelog.backport_gc | |
new file mode 100644 | |
index 0000000..b617fc8 | |
--- /dev/null | |
+++ b/Changelog.backport_gc | |
@@ -0,0 +1,128 @@ | |
+Tue Jan 17 12:32:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> | |
+ | |
+ * gc.c (aligned_malloc, aligned_free): covered missing defined | |
+ operators and fixes for cygwin. |
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
export NGINX_DIR=../nginx | |
export LOG_DIR=$NGINX_DIR/log | |
export SOCK_DIR=$NGINX_DIR/socks | |
export APP=`basename "$(realpath "$(dirname "$0")")"` | |
PID_FILE=$SOCK_DIR/$APP.pid | |
if [ -e "$PID_FILE" ] ; then | |
PID=`cat $PID_FILE` | |
if [ -n `ps aux | awk '/rainbows/ && /$PID/ && !/awk/ {print $0}'` ] ; then | |
echo "Action: " $@ |
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/env ruby | |
require 'yaml' | |
y=[] | |
(1..10000).each{|x| | |
#next unless x/2==(1.0*x)/2 | |
z=x | |
divisors=[1] | |
_continue=true |
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
class Enumerator | |
class Error < Struct.new(:error) | |
end | |
def feed(v) | |
@feed = v | |
end | |
class StopIteration < ::StopIteration | |
attr :result | |
def initialize(msg, result) | |
super(msg) |
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
require 'eventmachine' | |
require 'fiber' | |
module EM | |
module Synchrony | |
class Mutex | |
def initialize | |
@waiters = [] | |
end | |
def lock |
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
require 'eventmachine' | |
EM.run do | |
i = 0 | |
myloop = ->{ | |
puts i | |
i += 1 | |
EM.next_tick(myloop) | |
} | |
EM.next_tick(myloop) |
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
# This notebook is on Atom N270 1.33GHz, so that I use only 500000 iterations | |
~/tmp/ruby$ ruby test_queue.rb 500000 | |
Rehearsal ------------------------------------------------------------- | |
pure man queue 2 0.570000 0.000000 0.570000 ( 0.574775) | |
pure man queue 4 0.550000 0.000000 0.550000 ( 0.557201) | |
pure man queue 15 0.600000 0.000000 0.600000 ( 0.599789) | |
pure man queue 16 1.620000 0.000000 1.620000 ( 1.615062) | |
pure man queue 48 1.720000 0.000000 1.720000 ( 1.729971) | |
pure man queue 128 2.130000 0.000000 2.130000 ( 2.136135) | |
pure ruby smart queue 4 1.170000 0.000000 1.170000 ( 1.166562) |
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
class BitSet | |
def initialize | |
@bm = {} | |
end | |
def set(i) | |
n = i >> 4 | |
@bm[n] = @bm[n].to_i | (1 << (i & 0xF)) | |
end | |
def test(i) | |
@bm[i/16].to_i[i & 0xF] != 0 |