Skip to content

Instantly share code, notes, and snippets.

Timothy Elliott ender672

Block or report user

Report or block ender672

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ender672
ender672 / mitm_omniture.py
Created Nov 21, 2014
mitmproxy script for showing omniture events, evars, and props
View mitm_omniture.py
$ mitmdump -q -s mitm_omniture.py
View fetch.rb
require 'google-search'
require 'uri'
require 'open-uri'
require 'fileutils'
FileUtils.mkdir("images")
Google::Search::Image.new(query: 'High Quality').each do |image|
name = File.basename(URI.parse(image.uri).path)
path = File.join("images", name)
View gist:2638291
# Puma hangs when it receives a SIGTERM in Linux x86_64. Reproduce as follows:
#
# Start Puma
# $ puma
#
# Get the PID for Puma
# $ ps u
#
# Send SIGTERM
# $ kill 4321
@ender672
ender672 / gist:2582334
Created May 3, 2012
Multithreaded rack handler. Proof-of-concept. Use Puma instead.
View gist:2582334
require 'socket'
require 'uri'
require 'rack/handler' # gem install rack
require 'rack/rewindable_input'
require 'http/parser' # gem install http_parser.rb
require 'stringio'
module Rack::Handler
module Qute
def self.run(app, options={})
@ender672
ender672 / gist:2378417
Created Apr 13, 2012
Single-threaded, single-process, non-evented rack handler using the mongrel http parser
View gist:2378417
require 'rack/handler'
require 'socket'
require 'puma/puma_http11'
module Rack::Handler
module Qute
READ_SIZE = 500000
module NullIO
def self.gets; end
@ender672
ender672 / gist:2175941
Created Mar 23, 2012
A really small image resizing rack application
View gist:2175941
require 'rack'
require 'oil'
app = lambda do |env|
r = Rack::Request.new(env)
io = File.new(File.join('images', File.basename(r.path)), 'rb')
body = Oil::JPEG.new(io, r[:w].to_i, r[:h].to_i)
[200, { 'Content-Type' => 'image/jpeg' }, body]
end
View gist:1872559
#include <string.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
void
main()
{
xmlDocPtr doc;
xmlNodePtr cur;
xmlXPathContextPtr ctx;
View gist:1870254
diff --git a/ext/nokogiri/xml_document.c b/ext/nokogiri/xml_document.c
index 348344c..9f035ad 100644
--- a/ext/nokogiri/xml_document.c
+++ b/ext/nokogiri/xml_document.c
@@ -38,6 +38,13 @@ static void dealloc(xmlDocPtr doc)
NOKOGIRI_DEBUG_END(doc);
}
+static void
+mark(xmlDocPtr doc)
View gist:1864519
diff --git a/lib/nokogiri/xml/node_set.rb b/lib/nokogiri/xml/node_set.rb
index 37b3848..149e90e 100644
--- a/lib/nokogiri/xml/node_set.rb
+++ b/lib/nokogiri/xml/node_set.rb
@@ -240,6 +240,14 @@ module Nokogiri
end
end
+ def map
+ a = []
@ender672
ender672 / gist:1831918
Created Feb 15, 2012
1.9.3-p0 nokogiri segfault fix
View gist:1831918
diff --git a/lib/nokogiri/xml/node_set.rb b/lib/nokogiri/xml/node_set.rb
index 37b3848..cb99cdd 100644
--- a/lib/nokogiri/xml/node_set.rb
+++ b/lib/nokogiri/xml/node_set.rb
@@ -234,8 +234,8 @@ module Nokogiri
###
# Iterate over each node, yielding to +block+
- def each(&block)
- 0.upto(length - 1) do |x|
You can’t perform that action at this time.