This file contains 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
# reproducer for https://github.com/jruby/jruby-openssl/issues/236 | |
# If a certificate has two trust paths, jruby doesn't prioritize using non expired certificates, while CRuby (openssl 1.1.1+) does | |
# In this reproducer we have a leaf certificate with two possible chains: | |
# a) leaf -> intermediate cert A -> ISRG Root X1 cross-signed by (expired) DST ROOT CA X3 -> (expired) DST ROOT CA X3 | |
# b) leaf -> intermediate cert B -> ISRG Root X1 | |
# JRuby will produce chain a) causing an error, while CRuby produces a valid chain b) | |
require 'openssl' | |
require 'net/http' | |
def cert_from_url(url) |
This file contains 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
input { | |
rabbitmq { | |
codec => plain | |
host => "localhost" | |
key => "#" | |
exchange => "sysmsg" # string (optional) | |
queue => 'dur-no-policy-4' | |
durable => true | |
This file contains 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
# Copyright 2012-2013 Barry Allard <[email protected]> | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without modification, | |
# are permitted provided that the following conditions are met: | |
# | |
# 1. Redistributions of source code must retain the above copyright notice, this | |
# list of conditions and the following disclaimer. | |
# | |
# 2. Redistributions in binary form must reproduce the above copyright notice, |
This file contains 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
# Monkeypatch to disable connection pooling in ActiveRecord | |
module ActiveRecord | |
module ConnectionAdapters | |
class ConnectionPool | |
def checkout | |
c = ActiveRecord::Base.send(spec.adapter_method, spec.config.dup) | |
c.verify! | |
c | |
end |
This file contains 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 'jruby/profiler' | |
profile_data = JRuby::Profiler.profile do | |
# code to be profiled.... | |
end | |
# print data in flat format to STDOUT : | |
profile_printer = JRuby::Profiler::FlatProfilePrinter.new(profile_data) | |
profile_printer.printProfile(STDOUT) |
This file contains 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
-- PostgreSQL 9.2 beta (for the new JSON datatype) | |
-- You can actually use an earlier version and a TEXT type too | |
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8 | |
-- Inspired by | |
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html | |
-- http://ssql-pgaustin.herokuapp.com/#1 | |
-- JSON Types need to be mapped into corresponding PG types | |
-- |
This file contains 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 'rubygems' | |
%w(action_controller/railtie).map &method(:require) | |
class JrubyRackTest < Rails::Application | |
config.secret_token = routes.append { root :to => 'send_file#deliver' }.inspect | |
initialize! | |
end | |
run JrubyRackTest |
This file contains 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
namespace :db do | |
namespace :sessions do | |
desc "Clean up expired Active Record sessions (updated before ENV['UPDATED_AT'], defaults to 1 month ago)." | |
task :expire => :environment do | |
time = Time.parse( ENV['UPDATED_AT'] || 1.month.ago.to_s(:db) ) | |
say "cleaning up expired sessions (older than #{time}) ..." | |
session = ActiveRecord::SessionStore::Session | |
rows = session.delete_all ["updated_at < ?", time] | |
say "deleted #{rows} session row(s) - there are #{session.count} session row(s) left" | |
end |