Skip to content

Instantly share code, notes, and snippets.

# -- Rule engine initialization ----------------------------------------------
# Enable ModSecurity, attaching it to every transaction. Use detection
# only to start with, because that minimises the chances of post-installation
# disruption.
#
SecRuleEngine DetectionOnly
# -- Request body handling ---------------------------------------------------
@sbull
sbull / output
Created April 9, 2015 06:53
debugging https://github.com/rails/rails/issues/19084, reproduction against rails master
$ bundle exec rails runner route_helpers_debug.rb 20 && spring stop
Threads: 20, Iterations per thread: 20
Running Mounted Engine dummy_path...
6/-/16/-/19/-/15/-/14/-/7/-/13/-/12/-/3/-/8/-/9/-/2/-/5/-/1/-/0/-/10/-/18/-/11/-/4/-/17/-/12/-/7/-/3/-/2/-/9/-/1/-/0/-/14/-/15/-/10/-/8/-/11/-/16/-/4/-/11/-/13/-
/18/-/6/-/17/-/12/-/6/-/7/-/3/-/6/-/9/-/1/-/6/-/15/-/10/-/5/-/8/-/16/-/11/-/19/-/13/-/17/-/2/-/18/-/7/-/3/-/0/-/14/-/9/-/6/-/1/-/15/-/10/-/4/-/5/-/8/-/4/-/19/-/1
3/-/17/-/2/-/18/-/12/-/2/-/0/-/3/-/14/-/9/-/6/-/15/-/14/-/16/-/11/-/10/-/5/-/8/-/10/-/13/-/19/-/7/-/17/-/12/-/13/-/0/-/2/-/13/-/3/-/6/-/15/-/16/-/13/-/11/-/4/-/1
3/-/8/-/19/-/18/-/7/-/17/-/18/-/0/-/2/-/14/-/0/-/3/-/6/-/15/-/11/-/16/-/4/-/10/-/13/-/8/-/1/-/19/-/8/-/17/-/12/-/8/-/18/-/2/-/14/-/0/-/5/-/6/-/3/-/15/-/16/-/11/-
/4/-/10/-/7/-/13/-/17/-/19/-/12/-/8/-/19/-/2/-/8/-/5/-/0/-/15/-/6/-/11/-/16/-/10/-/4/-/16/-/9/-/7/-/13/-/18/-/17/-/14/-/18/-/19/-/2/-/8/-/0/-/5/-/0/-/6/-/1/-/10/
-/4/-/1/-/16/-/7/-/12/-/17/-/14/-/18/-/19/-/2/-/3/-/15/-/5/-/8/-/0/-/1
$ rails runner route_helpers_debug.rb && spring stop
I, [2015-02-26T11:17:19.001137 #56809] INFO -- : ** [Raven] Raven 0.12.3 ready to catch errors
Threads: 10, Iterations per thread: 10
Running Mounted Engine dummy_path...
6/-/2/-/8/-/9/-/3/-/0/-/5/-/4/-/7/-/2/-/6/-/3/-/9/-/5/-/4/-/8/-/7/-/2/-/6/-/3/-/9/-/4/-/8/-/7/-/2/-/6/-/3/-/5/-/4/-/8/-/7/-/2/-/9/-/3/-/5/-/4/-/8/-/7/-/2/-/9/-/3/-/5/-/4/-/8/-/7/-/9/-/5/-/4/-/8/-/7/-/2/-/9/-/3/-/5/-/8/-/7/-/2/-/9/-/3/-/5/-/8/-/2/-/9/-/3/-/5/-/7/-/8/-/2/-/9/-/5/-/
Finished thread 2.
3/-/
Finished thread 3.
7/-/
Finished thread 5.
@sbull
sbull / output
Created February 26, 2015 03:40
Rails Mounted Engine url_helpers workaround for thread bug undefined method `url_options' for #<Module:0x007fb64b864d50>
$ rails runner route_helpers_debug.rb
Threads: 10, Iterations per thread: 10
Running Mounted Engine dummy_path...
4/-/2/-/3/-/8/-/6/-/1/-/9/-/7/-/0/-/4/-/2/-/3/-/8/-/6/-/1/-/9/-/7/-/0/-/4/-/2/-/3/-/8/-/6/-/1/-/9/-/7/-/0/-/4/-/2/-/3/-/8/-/6/-/1/-/9/-/7/-/0/-/4/-/2/-/3/-/8/-/6/-/1/-/9/-/7/-/0/-/4/-/2/-/3/-/8/-/6/-/1/-/9/-/7/-/0/-/4/-/2/-/3/-/8/-/6/-/1/-/9/-/7/-/0/-/4/-/2/-/3/-/8/-/6/-/1/-/9/-/7/-/0/-/4/-/2/-/3/-/8/-/6/-/1/-/9/-/7/-/0/-/2/-/3/-/4/-/8/-/1/-/9/-/7/-/0/-/
Finished thread 0.
Finished thread 1.
Finished thread 2.
@sbull
sbull / output
Created February 26, 2015 00:49
Rails Engine mounted routes multi-threading bug, undefined method `url_options'
$ rails runner route_helpers_debug.rb
Threads: 10, Iterations per thread: 10
Running Mounted Engine dummy_path...
6/-/2/-/8/-/7/-/9/-/1/-/3/-/4/-/2/-/6/-/7/-/9/-/1/-/3/-/8/-/4/-/6/-/7/-/9/-/1/-/2/-/3/-/4/-/6/-/7/-/1/-/3/-/4/-/9/-/6/-/7/-/3/-/1/-/4/-/9/-/7/-/3/-/1/-/4/
-/7/-/9/-/3/-/1/-/7/-/9/-/3/-/7/-/1/-/9/-/3/-/7/-/9/-/3/-/
Finished thread 3.
9/-/
Finished thread 7.
Finished thread 9.
@sbull
sbull / output
Last active August 29, 2015 14:15
Test script for undefined method `url_options' for #<Module:xxx> on Rails 4.2: https://github.com/puma/puma/issues/647
$ rails runner route_helpers_debug.rb
Threads: 10, Iterations per thread: 10
Running Rails...
5/2/7/8/1/9/4/5/7/8/9/2/4/7/8/9/2/4/8/9/2/4/8/9/4/8/9/4/9/4/9/4/9/9/
Finished thread 9.
-------
ERRORS: 9
Exception in thread 0, iteration 0: undefined method `url_options' for #<Module:0x007f7cc4735210>
@sbull
sbull / gist:654304a00dbb1aa7b02e
Created February 18, 2015 03:21
Stacktrace of "NoMethodError: undefined method `url_options'" on Rails.application.routes.url_helpers.my_path() for https://github.com/puma/puma/issues/647
NoMethodError: undefined method `url_options' for #<Module:0x007ff474ee5960>
Stacktrace (most recent call first):
action_dispatch/routing/route_set.rb:218:in `call'
options = t.url_options.merge @options
action_dispatch/routing/route_set.rb:334:in `block (2 levels) in define_url_helper'
helper.call self, args, options
activity.rb:322:in `block in get_rx_push'
url: rx.patient_id? ? routes.provider_patient_path(rx.patient_id) : routes.provider_root_path,
@sbull
sbull / gist:65c985c09e6c430af595
Created February 18, 2015 03:07
Stacktrace of "ActionView::Template::Error: undefined method `url_options'" on rails_admin.show_path(...) for https://github.com/puma/puma/issues/647
ActionView::Template::Error undefined method `url_options' for #<Module:0x007fbdc252fbc0>
Stacktrace (most recent call first):
action_dispatch/routing/route_set.rb:271:in `call'
controller_options = t.url_options
action_dispatch/routing/route_set.rb:222:in `call'
super
action_dispatch/routing/route_set.rb:334:in `block (2 levels) in define_url_helper'
helper.call self, args, options
@sbull
sbull / test-npm-pack
Created January 8, 2015 17:27
Bash script to test the accuracy of `npm pack` (and hopefully `npm publish`), and to attempt to reproduce an issue where files sometimes mysteriously get left out of the module when using `npm publish`. This supports .npmignore files, but may be missing some file exclusions. Built on ubuntu, requires basic tools (git, awk, sed, ...).
#!/bin/bash
# USAGE: test-npm-pack [num-tests]
# (run from the top of your git repository)
# There are sometimes problems with npm-publish (missing files etc.),
# so be sure to test the build!
# https://github.com/npm/npm/issues/5082