DEFLATE BREACH is a proposed DEFLATE compressor designed to mitigate BREACH attacks with only a moderate loss in compression ratio.
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 "net/http" | |
def start_server | |
# Remove the X to enable the parameters for tuning. | |
# These are the default values as of Ruby 2.2.0. | |
@child = spawn(<<-EOC.split.join(" ")) | |
XRUBY_GC_HEAP_FREE_SLOTS=4096 | |
XRUBY_GC_HEAP_INIT_SLOTS=10000 | |
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8 | |
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0 |
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
#!/usr/bin/env ruby | |
HELP_STR = "Usage: $ remove_rightslink_images file1.pdf file2.pdf" | |
begin | |
require 'hexapdf' # HexaPDF is AGPL licensed according to https://hexapdf.gettalong.org/ | |
rescue LoadError | |
if system("gem install --no-doc hexapdf") | |
Gem.clear_paths | |
require "hexapdf" |
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
# by default you only get 1000 objects at a time | |
# so you have to roll your own cursor | |
S3.connect! | |
objects = [] | |
last_key = nil | |
begin | |
new_objects = AWS::S3::Bucket.objects(bucket_name, :marker => last_key) | |
objects += new_objects |
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
# Natively, Enumerators get JSONized like "#<Enumerator::Lazy:0x007f8714807080>", or they explode, either of which is a problem. | |
# We want them to make an array, and do it lazily so we don't have to keep the items in memory! | |
class Enumerator | |
def to_json(state) | |
state.depth += 1 | |
string = "[\n" | |
first_item = true | |
self.each do |item| |
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
# config/deploy/production.rb | |
# okay, this is to make sure I don't miss another deploy. | |
def abort_deploy | |
puts "Deploy aborted." | |
exit 1 | |
end | |
unless `git show-ref heads/stable`.split[0] == `git show-ref heads/master`.split[0] |
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
$ time bundle exec cucumber features/admin/authentication.feature | |
MID-2007 15-INCH MACBOOK PRO | |
2.2 GHz Core 2 Duo 6GB 320GB 7200rpm HD | |
# Hot | |
startup 24.7s | |
total 28.4s | |
# Cold | |
startup 38.3s | |
total 43.3s |
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
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1VmCogSSRe2/OWkNI1Be5IxLcr5iX2hlArqCqHPXqzqLP9DQeU93g1Ml0HpdLq2FRqIbWNDLMmULu9zzFqAQIqPfqwonLqjnH3TiiUv0gh9Dg+ePFkGU7FYGtD3EEvFoZEmlEoZC61HLYY0AcItDM2mRVWi4gWw9nJm7E0iZYUylaLxpQVxFDuqWg6CCgHj6GxMQ8IoQp5feuPCe9a70B9w8zqhhNOlKfIddxx2pcBU2gjHyVfslWr4WuRziuZ3nHmnleCawirLi4GyoWhEsGeKw0pDRfazZyVmLgOSF3gB1qxJddFmRHYZ6a9s4oMOdxf54C6j7hb9dKvoihMde2Q== brian@wads-3-229-75.resnet.mtu.edu |
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
#!/usr/bin/env ruby | |
require 'fileutils' | |
if ARGV.size < 3 | |
puts <<-USAGE | |
mass_rename [file1 file2 ...] <regexp> <replacement> | |
USAGE | |
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
#!/usr/bin/env ruby | |
require 'benchmark' | |
if ARGV[0] | |
ENV['RAILS_ENV'] = %w{development test production staging}.find { |e| e[0] == ARGV[0][0] } || ARGV[0] | |
else | |
ENV['RAILS_ENV'] ='test' | |
end |
NewerOlder