Skip to content

Instantly share code, notes, and snippets.

@atpons
Created April 22, 2018 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atpons/73c36932f06184deb16191caa4f5abc8 to your computer and use it in GitHub Desktop.
Save atpons/73c36932f06184deb16191caa4f5abc8 to your computer and use it in GitHub Desktop.
##########################################
# kemuideとレポート用紙を行き来するスニペット
# レポート用紙から貼り付けるとkemu-ideに貼り付けられるし
# kemu-ide から貼り付けるとレポート用紙にペーストできるやつ(命令非対応ですが)
# TODO: 命令に対応する
##########################################
STDERR.puts "[*] Waiting your snippet"
input = $stdin.read.split("\n")
if input[0].split("\t").count > 3
input.each do |t|
t.split("\t").each_with_index do |x, i|
puts + x if i >= 4
end
end
else
puts "ADDR\tDATA\tOPECODE"
code = 0
input.each do |t|
puts "#{sprintf("%02d",code+=1)}\tXX\t#{t}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment