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
% ruby --disable-gems test.rb | |
{:T_HASH=>1, :T_DATA=>2} | |
{:T_ARRAY=>1, :T_HASH=>1, :T_DATA=>1} |
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 '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 |
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
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 |
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 '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+)\)/ |
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
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 |
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 | |
# | |
# 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 | |
# |
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
% 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 | |
|------------------------------------------------------------------------ |
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
resources: | |
- type: package | |
name: zsh | |
- type: package | |
name: screen | |
- type: package | |
name: subversion | |
- type: group | |
name: <%= user %> |
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
# 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 |
NewerOlder