Skip to content

Instantly share code, notes, and snippets.

import sys
def call_is_correct(ch, index):
gdb.execute(f"r '{'*' * 32}'")
gdb.execute(f"set $rdi={ch}")
gdb.execute(f"set $rsi={index}")
gdb.execute("j *check+90") # just skip `fork` and so on
gdb.execute("fin")
res = gdb.execute("p $rax", to_string=True)
return int(res.split(" ")[2], 16)
# $ ruby reg.rb < CoreMark_RV32I.trace
reg = [""] * 32
reg[0] = "0x00000000"
while inst = gets
lv, rv = inst.split("#")
pc = lv.split(" ")[0][..-2]
# break if pc == "0xXXXX"
unless rv.include?("no destination")
rd, _, val, *_ = rv.split(" ")
@taiyoslime
taiyoslime / cpu_7_4.v
Last active June 13, 2020 08:38
ハードウェア設計論 課題7-4
module CPU(CK, RST, IA, ID, DA, DD, RW);
input CK, RST;
input [15:0] ID;
output RW;
output [15:0] IA, DA;
inout [15:0] DD;
reg FLAG, RW;
reg [1:0] STAGE;
@taiyoslime
taiyoslime / eca.rb
Last active April 23, 2020 14:45
Elementary cellular automatonをシミュレートする
class Eca
attr_reader :cells
def initialize(role, size = 200)
@role = role
@cells = Array.new(size, 0)
raise if role < 0 || role > 255
end
def set(f, offset = nil)
str = f.is_a?(Integer) ? f.to_s(2) : f.is_a?(String) ? f : nil

Keybase proof

I hereby claim:

  • I am taiyoslime on github.
  • I am taiyoslime (https://keybase.io/taiyoslime) on keybase.
  • I have a public key whose fingerprint is 8685 988A C7DC 78EB A3F3 C255 7574 D817 62BF B92A

To claim this, I am signing this object:

class Node
attr_accessor :name, :prob, :children, :code
def initialize name, prob, children = [], code = nil
@name = name
@prob = prob
@children = children
@code = code
end
@taiyoslime
taiyoslime / 1_defense.py
Created December 23, 2018 14:18
defense scripts of server-1(壱) in SECCON CTF 2018 International
import requests
import json
BASE_URL = "http://172.24.0.11/"
BASE_DEFENSE_URL = BASE_URL + "defense/"
TEAM_NAME = "TSG"
TEAM_IP_ADDRESS = "192.168.***.***"
with open("defense", "r") as f:
@taiyoslime
taiyoslime / nowplaying.scpt
Last active May 15, 2020 19:34
iTunesで再生されてる曲を取得するやつ(Mac)
#!/usr/bin/osascript -l JavaScript
app = Application("com.apple.iTunes");
name = app.currentTrack().name()
artist = app.currentTrack().artist()
album = app.currentTrack().album()
duration = app.currentTrack().duration()
sec = duration / 60 | 0
min = duration % 60 | 0
if(min < 10) min = "0" + min
result = `${name} - ${artist}/${album} [${sec}:${min}]`