Skip to content

Instantly share code, notes, and snippets.

View bararchy's full-sized avatar

Bar Hofesh bararchy

View GitHub Profile
@bararchy
bararchy / rproxy.rb
Last active August 29, 2015 14:20 — forked from buzztaiki/rproxy.rb
# HTTP Reverse proxy server
# Original Source: http://rubyforge.org/snippet/download.php?type=snippet&id=162
# Use case: you have several services running as different users
# for security purposes (they might even be chrooted).
# In production we use apache but for testing I prefer to use
# webrick because I find it more flexible for unit testing.
# The proxy mapping is modelled on the ProxyPass directive
# of apache. For example:
#
@bararchy
bararchy / fiddle.rb
Last active August 29, 2015 14:09 — forked from ik5/fiddle.rb
require 'fiddle'
require 'socket'
libssl = Fiddle.dlopen('/usr/lib/libssl.so')
ssl_init = Fiddle::Function.new(libssl['SSL_library_init'],[],Fiddle::TYPE_INT)
ssl_load_error = Fiddle::Function.new(libssl['SSL_load_error_strings'],[],Fiddle::TYPE_INT)
ssl_client_method = Fiddle::Function.new(libssl['SSLv3_client_method'],[],Fiddle::TYPE_LONG)
ssl_ctx = Fiddle::Function.new(libssl['SSL_CTX_new'],[Fiddle::TYPE_LONG],Fiddle::TYPE_LONG)
ssl_ctx_reneg = Fiddle::Function.new(libssl['SSL_CTX_sess_connect_renegotiate'],[Fiddle::TYPE_LONG],Fiddle::TYPE_LONG)