Skip to content

Instantly share code, notes, and snippets.

View jvoorhis's full-sized avatar

Jeremy Voorhis jvoorhis

View GitHub Profile
2010 07 09 10:30
Galois Tech Talk: Requirements and Performance of Data Intensive, Irregular Applications
Iavor S. Diatchki
Pacific NW National Laboratory
Analytics
Security
Anomaly detection
#!/usr/bin/env ruby
require 'webrick'
require 'webrick/httpproxy'
callback = proc do |request, response|
if response.content_type =~ /jpe?g|png|gif/
f = Tempfile.new("upside-down")
f.write response.body
f.close
#!/usr/bin/env ruby
require 'webrick'
require 'webrick/httpproxy'
callback = proc do |request, response|
if response.content_type =~ /jpe?g|png|gif/
f = Tempfile.new("upside-down")
f.write(response.body)
f.close
undefined method `taint!' on an instance of Hash.
kernel/delta/kernel.rb:85:in `taint! (method_missing)'
kernel/common/hash.rb:555:in `reject'
@jvoorhis
jvoorhis / fm.ll
Created April 7, 2011 05:41
LLVM bytecode dump from Siren fm.rb
; ModuleID = 'Siren'
%0 = type { float, float, float, float, float }
declare float @powf(float, float)
declare float @sinf(float)
declare float @cosf(float)
@jvoorhis
jvoorhis / gist:969630
Created May 12, 2011 22:48
visitor vs catamorphism
class Int
attr_reader :value
def initialize(value)
@value = value
end
def accept(visitor, *data)
visitor.visit_int(self, *data)
end
def fold(rules)
rules[Int].call(value)
irb(main):028:0> Complex(-1,1).real == -1
=> true
irb(main):029:0> -1 ** 0
=> -1
irb(main):030:0> Complex(-1,1).real ** 0
=> 1
NoMethodError (You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]):
lib/heap_dump/dumped_lookup_table.rb:7:in `each'
lib/heap_dump/dumped_module.rb:38:in `find_class'
lib/heap_dump/decoder.rb:166:in `decode'
lib/read_dump.rb:23:in `initialize'
lib/read_dump.rb:32:in `session'
app/controllers/heap_viewer_controller.rb:5:in `show'
@jvoorhis
jvoorhis / gist:1104984
Created July 25, 2011 19:37
function pointers with ruby-llvm
require 'llvm/core'
require 'llvm/execution_engine'
require 'llvm/transforms/scalar'
LLVM.init_x86
mod = LLVM::Module.new("Function Pointers")
F = LLVM::Function([LLVM::Int], LLVM::Int)
FP = LLVM::Pointer(F)
class Action < Struct.new(:action)
def initialize(&block)
super block
end
def call
action.call
end
def seq(rhs)