This file contains hidden or 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
/*#!as --gstabs+ -o sketch.o sketch.s && ld -o sketch -e _start sketch.o && objdump -d -j .text -j .data sketch && ./sketch | |
*/ | |
.global _start | |
.macro sys_exit | |
mov r7, $0x01 /* set system call number to 1 (exit) */ | |
svc $0x00 /* supervisor call */ | |
.endm |
This file contains hidden or 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
/*#!as --gstabs+ -o sketch.o sketch.s && ld -o sketch -e _start sketch.o && objdump -d -j .text -j .data sketch && ./sketch | |
*/ | |
.global _start | |
.macro sys_exit | |
mov r7, $0x01 /* set system call number to 1 (exit) */ | |
svc $0x00 /* supervisor call */ | |
.endm |
This file contains hidden or 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
//#!gcc -O0 -g3 -gdwarf-2 -Wall c.c -o /tmp/a.out && /tmp/a.out 1 2 | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <sys/mman.h> | |
uint8_t* memory[255]; | |
uint8_t program_counter; |
This file contains hidden or 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
#!./perl -Ilib | |
use v5.19; | |
use strict; | |
use warnings; | |
use feature 'signatures'; | |
no warnings "experimental::signatures"; | |
use Test::More; |
This file contains hidden or 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 | |
MRUBY_CONFIG = 'sketch_mruby_config.rb' | |
File.open(MRUBY_CONFIG, "w") do |f| | |
f.puts `git show HEAD:build_config.rb` | |
end | |
ENV['MRUBY_CONFIG'] = MRUBY_CONFIG | |
def enable_gems | |
warn "enable_gems" |
This file contains hidden or 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
def guard_scope(&block) | |
context = self | |
guards = [] | |
context.define_singleton_method(:guard) do |&b| | |
guards << b | |
end | |
block.call | |
ensure |
This file contains hidden or 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
module Guard | |
@@guards = [] | |
def guard(&block) | |
set_trace_func(lambda {|event, file, line, id, binding, klass| | |
# p [event, file, line, id, binding, klass] | |
case event | |
when "call", "c-call" | |
for g in @@guards | |
g[:count] += 1 | |
end |
This file contains hidden or 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 'continuation' | |
class Guard | |
attr_reader :args | |
attr_reader :called | |
attr_reader :result | |
def initialize(&before_finish) | |
@args = nil | |
@guard_cc = nil |
This file contains hidden or 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 | |
class Foo | |
def hello | |
puts "Hello" | |
end | |
end | |
def localize_method(klass, method, &block) | |
unbound = klass.instance_method(method) |