Skip to content

Instantly share code, notes, and snippets.

NARUSE, Yui nurse

Block or report user

Report or block nurse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nurse / pid2line.rb
Last active Dec 27, 2018
Show source files and line numers of given process's threads
View pid2line.rb
#!/usr/bin/env ruby
# pid2line.rb
# Show source files and line numers of given process's threads
# This script works only on Linux.
nurse / gist:4324519
Last active Feb 28, 2018
View gist:4324519



Remove Fixnum and Bignum

Fixnum と Bignum を削除して、Integer クラスに統合する。両者は Flonum のように内部的に切り替えられる。

1 / 2 is Rational

Integer#/ の結果を Rational で返すようにする。

View static-check.rb
if false
class C
def m
def mm
nurse / gist:3015253
Last active Feb 23, 2017
View gist:3015253


「公案」とは禅で用いられ、なんたら かんたら。 この公案を考えることでオブジェクト指向プログラミングの悟りをなんたらかんたら。


  • Q: 変数とは何か?
  • A: 箱である
  • B: ラベルである
nurse / gist:555963
Last active Jan 24, 2017
JIS8 charset for emacs
View gist:555963

IRC 等で用いられるいわゆる半角カナを含む ISO-2022-JP variant の emacs 用設定


reg#  character set       ESC sequence  designated to
  6   US-ASCII            ESC ( B       G0
 13   JIS X 0201-Katakana ESC ( I       G0
 14   JIS X 0201-Roman    ESC ( J       G0
 42   JIS X 0208-1978     ESC $ @       G0
% ruby --disable-gems test.rb
{:T_HASH=>1, :T_DATA=>2}
{:T_ARRAY=>1, :T_HASH=>1, :T_DATA=>1}
View gist:f916e5ef81d59cfc7315
# p12ファイル内の秘密鍵に対応する公開鍵を表示
openssl pkcs12 -in foo.p12 -nodes | openssl rsa -passin pass: -pubout|openssl rsa -pubin -text
# 証明書を表示
openssl x509 -inform der -in ~/Downloads/ios_distribution.cer -text
openssl genrsa -des3 -out tls.2015.key 2048
openssl req -new -key tls.2015.key -out tls.2015.csr
mv tls.2015.key tls.2015.key.pass
openssl rsa -in tls.2015.key.pass -out tls.2015.key
View gist:f9a068c2e84f9324f7626795b212302e
require 'fiddle'
def create_large_string(size)
func =['rb_str_new'], [Fiddle::TYPE_VOIDP,Fiddle::TYPE_LONG], Fiddle::TYPE_VOIDP)
# returns fast on environments whose malloc delays the actual allocation
ptr =, size)
View gist:70ddf2b4e82537d71f066d8609853dc4
2016-09-12 07:02:10 +0900
target 0: ruby 2.4.0dev (2016-07-22 trunk 55727) [x86_64-linux] at "./miniruby55727 -I./lib -I. -I.ext/common --disable-gem"
target 1: built-ruby (ruby 2.4.0dev (2016-09-11) [x86_64-linux]) at "./miniruby -I./lib -I. -I.ext/common --disable-gem"
measure target: real
def ack(m, n)
if m == 0 then
nurse / yarv-profile.rb
Last active Jul 9, 2016
Profile perf(3)'s report into YARV instructions
View yarv-profile.rb
#!/usr/bin/env ruby
require 'pp'
files = {'' => [], 'insns.def' => []}
current_insn = nil
current_filename = ''
lineno_offset = 0
IO.foreach('') do |line|
case line
when /^INSN_ENTRY\((\w+)\)/
You can’t perform that action at this time.