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
View result.sh
% ruby --disable-gems test.rb
{:T_HASH=>1, :T_DATA=>2}
{:T_ARRAY=>1, :T_HASH=>1, :T_DATA=>1}
View gist:f9a068c2e84f9324f7626795b212302e
require 'fiddle'
def create_large_string(size)
func = Fiddle::Function.new(Fiddle::Handle::DEFAULT['rb_str_new'], [Fiddle::TYPE_VOIDP,Fiddle::TYPE_LONG], Fiddle::TYPE_VOIDP)
# returns fast on environments whose malloc delays the actual allocation
ptr = func.call(nil, size)
end
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
-----------------------------------------------------------
app_answer
def ack(m, n)
if m == 0 then
@nurse
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 = {'vm.inc' => [], 'insns.def' => []}
current_insn = nil
current_filename = 'vm.inc'
lineno_offset = 0
IO.foreach('vm.inc') do |line|
case line
when /^INSN_ENTRY\((\w+)\)/
View mame20160323.rb
Original:
Performance counter stats for './miniruby -e@v=42; n=100_000_000;while n>0; x=@v; x=@v; x=@v; n-=1;end':
5675.422561 task-clock (msec) # 0.998 CPUs utilized
159 context-switches # 0.028 K/sec
2 cpu-migrations # 0.000 K/sec
889 page-faults # 0.157 K/sec
16521817067 cycles # 2.911 GHz
4121915626 stalled-cycles-frontend # 24.95% frontend cycles idle
@nurse
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.
# https://gist.github.com/nurse/0619b6af90df140508c2
#
View gist:54361623c3fc3acafe31
% time ./miniruby -e'a=100;i=0;while i<0xffffff;i+=1;a*=557;a+=2;a%=100000;end'
./miniruby -e'a=100;i=0;while i<0xffffff;i+=1;a*=557;a+=2;a%=100000;end' 2.64s user 0.01s system 99% cpu 2.649 total
% ruby -e'puts RubyVM::InstructionSequence.compile(%q{a=100;i=0;while i<0xffffff;i+=1;a*=557;a+=2;a%=
100000;end}).disasm'
== disasm: #<ISeq:<compiled>@<compiled>>================================
== catch table
| catch type: break st: 0015 ed: 0060 sp: 0000 cont: 0060
| catch type: next st: 0015 ed: 0060 sp: 0000 cont: 0012
| catch type: redo st: 0015 ed: 0060 sp: 0000 cont: 0015
|------------------------------------------------------------------------
@nurse
nurse / chkbuild.yml.erb
Created Sep 13, 2015
template for chkbuild with serverkit
View chkbuild.yml.erb
resources:
- type: package
name: zsh
- type: package
name: screen
- type: package
name: subversion
- type: group
name: <%= user %>
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
You can’t perform that action at this time.