Skip to content

Instantly share code, notes, and snippets.

quezacoatl / flatten.rb
Created April 3, 2018 06:51
Flatten array in Ruby
View flatten.rb
def flatten(arr, flat=[])
arr.each_with_object(flat) do |item, result|
if item.is_a?(Array)
flatten(item, flat)
result << item
quezacoatl / cloud_front.rb
Created September 16, 2016 06:07
CloudFront format for request-log-analyzer
View cloud_front.rb
class CloudFront < RequestLogAnalyzer::FileFormat::Base
extend RequestLogAnalyzer::FileFormat::CommonRegularExpressions
line_definition :access do |line|
line.header = true
line.footer = true
line.regexp = /^(#{timestamp('%Y-%m-%d %H:%M:%S')})\s(\w+)\s(\d+)\s(#{ip_address})\s(\w+)\s(\S+)\s(\S+)\s(\d+)\s(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\w+)\s(\S+)\s(\S+)\s(\w+)\s(\d+)\s(\S+)\s(#{ip_address}|-)\s+(\S+)\s(\S+)\s(\w+)\s(\S+)/
quezacoatl / Gemfile
Last active May 10, 2016 02:11
Ruby 2.2.X AWS SDK memory leak
View Gemfile
source ''
gem 'nokogiri'
gem 'aws-sdk'
gem 'fake_sqs'
gem 'newrelic_rpm'
quezacoatl / Gemfile
Created March 5, 2015 07:32
AWS SDK 2.0.29 XML parsing issue
View Gemfile
source ''
#gem 'nokogiri'
gem 'aws-sdk', '~> 2'