Skip to content

Instantly share code, notes, and snippets.

Avatar

Paolo Montrasio pmontrasio

View GitHub Profile
@pmontrasio
pmontrasio / safe_s3.rb
Last active Sep 9, 2020
Compress a file, encrypt it, upload it to S3. Download, decrypt, uncompress.
View safe_s3.rb
#!/bin/env/ruby
# gem "aws-sdk", "~> 2"
require "rubygems"
require "zlib"
require "rubygems/package"
require "securerandom"
gem "aws-sdk"
require "aws-sdk"
@pmontrasio
pmontrasio / RBS-141226.1655.csv
Created Dec 26, 2014
Ruby 2.2.0 standard binary vs Ruby 2.2.0 compiled from source gcc 4.9 linux x86_64
View RBS-141226.1655.csv
Benchmark File Input Size RBS-ruby-141225.221450 RBS-ruby-141226.162927
macro-benchmarks/bm_gzip.rb 100 4.030742813 4.145028601
macro-benchmarks/bm_hilbert_matrix.rb 10 0.001292123 0.001646983
macro-benchmarks/bm_hilbert_matrix.rb 20 0.024026407 0.02280839
macro-benchmarks/bm_hilbert_matrix.rb 30 0.072715057 0.078463772
macro-benchmarks/bm_hilbert_matrix.rb 40 0.214802309 0.209679799
macro-benchmarks/bm_hilbert_matrix.rb 50 0.524640522 0.483797267
macro-benchmarks/bm_hilbert_matrix.rb 60 1.135183113 1.036128127
macro-benchmarks/bm_mpart.rb 300 0.144332281 0.231152505
macro-benchmarks/bm_norvig_spelling.rb 50 3.47946138 3.401385454
@pmontrasio
pmontrasio / RBS-ruby-141226.162927.yaml
Created Dec 26, 2014
Ruby 2.2.0 compiled from source gcc 4.9 linux x86_64
View RBS-ruby-141226.162927.yaml
---
name: /home/me/ruby-benchmark-suite/benchmarks/macro-benchmarks/bm_gzip.rb
parameters:
- 100
ruby_ver: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
---
name: /home/me/ruby-benchmark-suite/benchmarks/macro-benchmarks/bm_gzip.rb
parameter: 100
iterations: 5
max: 4.5621428
@pmontrasio
pmontrasio / RBS-ruby-141225.221450.yaml
Created Dec 26, 2014
Ruby 2.2.0 benchmark linux x86_64
View RBS-ruby-141225.221450.yaml
---
name: /home/me/ruby-benchmark-suite/benchmarks/macro-benchmarks/bm_gzip.rb
parameters:
- 100
ruby_ver: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
---
name: /home/me/ruby-benchmark-suite/benchmarks/macro-benchmarks/bm_gzip.rb
parameter: 100
iterations: 5
max: 4.049881914
@pmontrasio
pmontrasio / gist:2b69a7cd37d35740ef1e
Created Aug 23, 2014
gmaps-autocomplete-rails updated gemspec
View gist:2b69a7cd37d35740ef1e
# -*- encoding: utf-8 -*-
# stub: gmaps-autocomplete-rails 0.1.2.1 ruby lib
Gem::Specification.new do |s|
s.name = "gmaps-autocomplete-rails"
s.version = "0.1.2.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Kristian Mandrup"]
@pmontrasio
pmontrasio / gist:aeb15a618b5f288451bc
Created Aug 23, 2014
gmaps-autocomplete-rails outdated gemspec
View gist:aeb15a618b5f288451bc
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "gmaps-autocomplete-rails"
s.version = "0.1.2.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
@pmontrasio
pmontrasio / post_params
Created Dec 7, 2012
Gets the last POST parameters in Rails's log/development.log and pretty prints them
View post_params
#!/bin/bash
# DO NOT USE ON PRODUCTION LOGS: maybe there are ways to inject Ruby code into the
# parameters hash and you'll end up evaluating it
#
# usage: post_params
# run this in the main Rails directory
# tested on Linux with ruby 1.9.3-p327, bash 4.2.24
last_post_line=`grep -n "Started POST " log/development.log |tail -1|cut -f1 -d":"`
hash_line=`expr $last_post_line + 2`
@pmontrasio
pmontrasio / gist:1286705
Created Oct 14, 2011
Liquid user style for Firefox for the new ruby-toolbox layout
View gist:1286705
@-moz-document domain("ruby-toolbox.com") {
#content {width:70% !important;margin-right:1% !important}
#sidebar {width:28% !important}
#full {width:auto !important}
.container {margin-left:0.4% !important;margin-right:0.4% !important;width:auto !important;}
#main #full .featured {width:19% !important;margin-right:0.8% !important}
#main #full .featured .inner {height:195px !important;text-overflow:ellipsis !important;overflow:hidden !important}
}
You can’t perform that action at this time.