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 'pty' | |
| require 'expect' | |
| qemu_command = "qemu-system-x86_64 -enable-kvm -cdrom ~/alpines/alpine-virt-3.6.2-x86_64.iso -nographic" | |
| PTY.spawn qemu_command do |r, w, pid| | |
| p pid | |
| r.expect /localhost login: / do |message| | |
| puts "The message is #{message}." |
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
| CSV.read file, col_sep: "\t", quote_char: "\x00" |
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
| 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| |
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
| #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, |
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
| # 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 |
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
| curl https://rubygems.org/api/v1/gems/method_source/reverse_dependencies.json |
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
| 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 |
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 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']) |
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
| - 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: |
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
| - 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 | |
| ----------------------- |