Skip to content

Instantly share code, notes, and snippets.

View SpringMT's full-sized avatar

Spring_MT SpringMT

View GitHub Profile
== disasm: #<ISeq:<main>@./sample.rb>=================================== | == disasm: #<ISeq:<main>@./sample2.rb>==================================
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] a [ 1] a
0000 putspecialobject 3 ( 1) 0000 putspecialobject 3 ( 1)
0002 putnil 0002 putnil
0003 defineclass :A, <class:A>, 0 0003 defineclass :A, <class:A>, 0
0007 pop 0007 pop
0008 getinlinecache 15, <is:0> ( 13) 0008 getinlinecache 15, <is:0> ( 13)
0011 getconstant :A 0011 getconstant :A
0013 setinlinecache <is:0> 0013 setinlinecache <is:0>
@SpringMT
SpringMT / gist:922c6b8ffa35f9293cbc75307410f581
Last active November 17, 2017 14:51
fooがメソッド呼び出しになる
== disasm: #<ISeq:<main>@./sample2.rb>==================================
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] a
0000 putspecialobject 3 ( 1)
0002 putnil
0003 defineclass :A, <class:A>, 0
0007 pop
0008 getinlinecache 15, <is:0> ( 13)
0011 getconstant :A
0013 setinlinecache <is:0>
@SpringMT
SpringMT / gist:844432acc27318b86b44277e00f612fc
Last active November 17, 2017 14:47
fooがローカル変数になる
== disasm: #<ISeq:<main>@./sample.rb>===================================
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] a
0000 putspecialobject 3 ( 1)
0002 putnil
0003 defineclass :A, <class:A>, 0
0007 pop
0008 getinlinecache 15, <is:0> ( 13)
0011 getconstant :A
0013 setinlinecache <is:0>
% ruby ruby_compile.rb
compile file sample:
== disasm: #<ISeq:<main>@./sample_test.rb>==============================
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] hoe
0000 putspecialobject 3 ( 1)
0002 putnil
0003 defineclass :Hoe, <class:Hoe>, 0
0007 pop
0008 putnil ( 11)
% ruby ruby_compile.rb ~
compile file sample:
== disasm: #<ISeq:<main>@./sample_test.rb>==============================
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] hoe
0000 putspecialobject 3 ( 1)
0002 putnil
0003 defineclass :Hoe, <class:Hoe>, 0
0007 pop
0008 putnil ( 11)
@SpringMT
SpringMT / str_num_sample.rb
Created October 16, 2017 02:52 — forked from masquaremo/str_num_sample.rb
Rubyで文字列と数値を相互に変換するメソッドとかのまとめ
#!/usr/bin/ruby
#数値を16進数文字列に
p 65.to_s(16) #=> "41"
#数値をASCII文字に
p 65.chr #=> "A"
#文字列を16進数とみなして数値に
p "41".hex #=> 65
@SpringMT
SpringMT / poco-https.cpp
Created October 16, 2017 02:10 — forked from t-mat/poco-https.cpp
POCO : https example
#include "Poco/Exception.h"
#include "Poco/StreamCopier.h"
#include "Poco/URI.h"
#include "Poco/URIStreamOpener.h"
#include "Poco/Net/HTTPStreamFactory.h"
#include "Poco/Net/HTTPSStreamFactory.h"
#include "Poco/Net/AcceptCertificateHandler.h"
#include "Poco/Net/InvalidCertificateHandler.h"

やりたいこと

  • 実行するコマンドを簡単に管理したい(コマンドラインで打てるコマンドをよしなに実行できる)
    • YAMLとかで定義できるといい
    • PRに出して簡単にレビュー可能
  • 一回の実行で複数手順を順序を守って実行できる
  • 実行したコマンドの履歴を管理し重複した実行を防ぐことができる
  • capistrano経由でもローカルでも実行できるようにする   * サーバーのroleやホスト指定で実行可能だが、ローカルでも実行可能
==================================
Mode: cpu(1000)
Samples: 16 (0.00% miss rate)
GC: 0 (0.00%)
==================================
TOTAL (pct) SAMPLES (pct) FRAME
13 (81.2%) 5 (31.2%) #<Module:0x007fc52e865560>.timeout
8 (50.0%) 4 (25.0%) Net::HTTP#connect
3 (18.8%) 3 (18.8%) IO#read_nonblock
12 (75.0%) 1 (6.2%) Net::HTTP.get_print
==================================
Mode: wall(1000)
Samples: 80 (13.98% miss rate)
GC: 0 (0.00%)
==================================
TOTAL (pct) SAMPLES (pct) FRAME
41 (51.2%) 41 (51.2%) Net::BufferedIO#rbuf_fill
61 (76.2%) 29 (36.2%) Net::HTTP#connect
1 (1.2%) 1 (1.2%) Net::HTTP#use_ssl?
1 (1.2%) 1 (1.2%) Net::HTTPGenericRequest#initialize