Skip to content

Instantly share code, notes, and snippets.

View ouranos's full-sized avatar

Olivier Brisse ouranos

View GitHub Profile
@ouranos
ouranos / dd.log
Created July 2, 2020 01:25
EC2 EBS-SSD vs instance-store performance on a non EBS-optimized m5d.4xlarge
# /tmp/test = EBS-SSD
# /ephemeral/test = instance-store
[root@ip-172-31-26-72 ec2-user]# dd bs=1M count=1024 if=/dev/zero of=/ephemeral/test
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 3.15671 s, 340 MB/s
[root@ip-172-31-26-72 ec2-user]# dd bs=1M count=1024 if=/dev/zero of=/ephemeral/test
1024+0 records in
1024+0 records out
require 'benchmark/ips'
require 'securerandom'
require 'digest'
NUMBER = 10_000
id_array = Array.new(NUMBER) { SecureRandom.uuid }.freeze
def slow(array)
Digest::MD5.hexdigest(array.join('/'))
@ouranos
ouranos / benchmark_results.rb
Last active May 30, 2017 05:11 — forked from havenwood/benchmark_results.rb
Benchmarking serialization speed of YAML, JSON, Marshal, and MessagePack in Ruby, JRuby, and Rubinius
# ruby 2.3.3p222
user system total real
YAML 31.860000 0.000000 31.860000 ( 31.886926)
JSON 1.370000 0.000000 1.370000 ( 1.374081)
Marshal 0.710000 0.000000 0.710000 ( 0.711384)
MessagePack 0.510000 0.000000 0.510000 ( 0.505674)
# jruby 9.1.7.0 (2.3.1)
user system total real
YAML 26.270000 0.040000 26.310000 ( 25.652204)
@ouranos
ouranos / .editorconfig
Created July 1, 2016 04:34
Global editor config
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
@ouranos
ouranos / .editorconfig
Last active July 1, 2016 04:34
Global editor config
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
∫ ruby serialize_bench.rb
Rehearsal -------------------------------------------
json 0.170000 0.010000 0.180000 ( 0.174912)
yaml 6.350000 0.000000 6.350000 ( 6.353721)
marshal 0.170000 0.000000 0.170000 ( 0.171184)
bson 0.210000 0.000000 0.210000 ( 0.213753)
yajl 0.130000 0.000000 0.130000 ( 0.130591)
oj 0.080000 0.000000 0.080000 ( 0.075798)
eval 0.370000 0.000000 0.370000 ( 0.370350)
---------------------------------- total: 7.490000sec
@ouranos
ouranos / bio_brief.md
Last active April 20, 2016 02:19
BIO Migration Brief
# config/application.rb
config.middleware.insert_after ActionDispatch::Flash, Warden::Manager do |manager|
manager.default_strategies :authentication_token, :basic_auth
manager.failure_app = UnauthorizedController
end
# config/application.rb
config.middleware.insert_after ActionDispatch::Flash, Warden::Manager do |manager|
manager.default_strategies :authentication_token
manager.failure_app = UnauthorizedController
end
# app/controllers/application_controller.rb
class ApplicationController < ActionController::API
include WardenHelper
end