Skip to content

Instantly share code, notes, and snippets.

;; for spork
;; http://github.com/timcharper/spork
;; requirement gems: spork, spork-testunit
(defvar rinari-spork-executable "spork1.8"
"spork bin")
(defvar rinari-spork-test-executable "testdrb1.8"
"spork test bin")
;; egg-grep.el へ grep-edit.elを組み込む
;; grep-edit.elの設定
(add-hook 'egg-grep-setup-hook
(lambda ()
(define-key egg-grep-mode-map "\M-r" 'grep-narrow-down)
(define-key egg-grep-mode-map " "
'self-insert-command)
(define-key egg-grep-mode-map [backspace]
'backward-delete-char-untabify)
(defun buffer-file-name-copy ()
"現在開いているバッファのファイル名をkill-ringにコピーする。"
(interactive)
(let
((cusor (point))
(file-name (if (buffer-file-name)
(buffer-file-name) "")))
(progn
(insert file-name)
(kill-region cusor (point)))))
# http://redmine.ruby-lang.org/issues/show/3398
# http://redmine.ruby-lang.org/issues/show/1934
a = ""
1000000.times do |i|
i % 100 ? ObjectSpace.define_finalizer(a.dup, proc {}) : a.dup
end
diff --git a/ext/cmain.cpp b/ext/cmain.cpp
index c9c2fdd..cd7f747 100644
--- a/ext/cmain.cpp
+++ b/ext/cmain.cpp
@@ -464,12 +464,12 @@ extern "C" void evma_accept_ssl_peer (const unsigned long binding)
evma_get_peername
*****************/
-extern "C" int evma_get_peername (const unsigned long binding, struct sockaddr *sa)
+extern "C" int evma_get_peername (const unsigned long binding, struct sockaddr *sa, socklen_t *len)
diff --git a/lib/plugins/defaults/switch.rb b/lib/plugins/defaults/switch.rb
index 266ab60..83141cb 100644
--- a/lib/plugins/defaults/switch.rb
+++ b/lib/plugins/defaults/switch.rb
@@ -10,18 +10,30 @@ module Termtter::Client
passwords[config.user_name] = config.password
- if user_name
- config.user_name = normalize_as_user_name(arg)
# -*- coding: utf-8 -*-
h = "# -*- coding: utf-8 -*-\n@a='あ'"
p h.encoding
p h = h.encode("sjis")
p h.encoding
eval(h)
p @a
require "irb"
Encoding.default_internal = "cp932"
Encoding.default_external = "cp932"
path = "/home/nari/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/irb/lc/ja/error.rb"
src = IRB::MagicFile.open(path){|f| f.read}
p src.encoding
eval(src)
@authorNari
authorNari / gist:875822
Created March 18, 2011 09:36
CRuby's Parallel Marking (Draft)
CRuby's Parallel Marking (Draft)(Ja)
ソースコード: https://github.com/authorNari/ruby
※まだ実装中
1 Abstract
並列スレッドの仕事分配には「Arora's Task Stealing Deque」のアルゴリズムを利用する。
http://doi.acm.org/10.1145/277651.277678
また、並列マークの実装の大部分はOpenJDK7のコードを参考に独自改良したものである。
@authorNari
authorNari / bokuno_twitter.rb
Created March 27, 2011 02:57
my twitter!!!
# -*- coding: utf-8 -*-
$screen_names_of_me ||= []
$screen_names_of_timeline ||= []
$words_of_timeline ||= []
$tweet_counts ||= {}
$tweet_limit_of_day = 2
Earthquake.init do
output do |item|
next unless item["event"]