Skip to content

Instantly share code, notes, and snippets.

View ch1c0t's full-sized avatar

Anatoly Chernov ch1c0t

View GitHub Profile
Bundler.require
book = Gutenberg::Book.new_from_txt 'data/pg11.txt'
db = Sequel.sqlite
db.run "CREATE VIRTUAL TABLE units USING fts5(content);"
units = db[:units]
db.transaction do
book.each_with_index do |unit, index|
#define _GNU_SOURCE
#include <dlfcn.h>
#include <unistd.h>
#include <stdio.h>
typedef int (*LibcStartMainFnType)(int (*main)(int, char **, char **), int argc, char **argv,
int (*init)(void), void (*fini)(void),
void (*ldso_fini)(void), void (*stack_end));
int __libc_start_main(int (*main)(int, char **, char **), int argc, char **argv,
# http://eli.thegreenplace.net/2011/09/29/an-interesting-tree-serialization-algorithm-from-dwarf
def load array
root = Node.new array.shift.first
stack = [root]
array.each do |pair|
if pair.nil?
stack.pop
else
curl https://rubygems.org/api/v1/gems/method_source/reverse_dependencies.json
TRACE_POINTS = []
TRACE = TracePoint.new :return, :c_return do |t|
TRACE_POINTS << [t.event, t.path, t.lineno, t.binding, t.defined_class, t.method_id, t.return_value]
end
def Trace
TRACE_POINTS.clear
TRACE.enable
yield
TRACE.disable
module Hobby
module Auth
def self.[] *users
Module.new do
define_singleton_method :included do |app|
users.each do |user|
app.define_singleton_method user.downcase do |route|
action = route.action
route.action = -> do
if user = (user.find_by_token request.headers['Authorization'])
- rspec:0:./spec/http_spec.rb:8/Hobby::JSON #<Hobby::Test:0x00000003018e40> works
evil:Hobby::JSON.included:/home/ch1c0t/sources/ruby/hobby-json/lib/hobby/json.rb:6:581f7
@@ -1,5 +1,5 @@
-def self.included(app)
+def self.included
app.use(Rack::ContentType, "application/json")
app.response = Response
end
-----------------------
Mutant configuration:
- rspec:0:./spec/http_spec.rb:8/Hobby::JSON #<Hobby::Test:0x00000002f60818> works
[0/1897]
evil:Hobby::JSON.included:/home/ch1c0t/sources/ruby/hobby-json/lib/hobby/json.rb:6:581f7
@@ -1,5 +1,5 @@
-def self.included(app)
+def self.included
app.use(Rack::ContentType, "application/json")
app.response = Response
end
-----------------------
module Hobby
class Test
class Report
def initialize(exchanges)
@exchanges = self
end
end
end
end
module Hobby
class Test
class Report
def initialize exchanges
@exchanges = exchanges
end
def ok?
@exchanges.all? &:passed?
end