Skip to content

Instantly share code, notes, and snippets.

Roberto Ostinelli ostinelli

Block or report user

Report or block ostinelli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ostinelli /
Last active Dec 2, 2019
How to install erlang 19 on OSX
# download erlang 19: <> & untar
# download patch: <>
# apply patch
patch < a64c4d806fa54848c35632114585ad82b98712e8.diff
# ensure that openssl is installed in openssl@1.1/{version}
brew install openssl
# compile
ostinelli / intellij
Last active Nov 7, 2019
[Intellij] Run mix tests in open terminal
View intellij
Program: /Users/roberto/workspace/intellij_run_cmd
Arguments: "mix test $FilePathRelativeToProjectRoot$:$SelectionEndLine$"
ostinelli / biggest_file_by_ext.rb
Last active Sep 5, 2019
List biggest file size by extension on a directory.
View biggest_file_by_ext.rb
require 'find'
biggest_file_by_ext = {}
Find.find('.') do |path|
next if
# get file info
ext = File.extname(path)
next unless ext.length > 0
# get file size
size = File.size(path)
ostinelli /
Created Apr 12, 2019
Start local php server on OSX
php -S
ostinelli / simple_api_client.rb
Last active Dec 13, 2018
Simple JSON API Ruby Client
View simple_api_client.rb
require 'net/http'
require 'json'
class Client
def call(method, url, path=nil, headers={}, body=nil, timeout=60)
net_class = Object.const_get("Net::HTTP::#{constantize(method)}")
uri = URI("#{url}#{path}")
View Preferences.Sublime-settings
"ensure_newline_at_eof_on_save": true,
"font_size": 12.0,
"trim_trailing_white_space_on_save": true
ostinelli / aws_acl_updater.rb
Last active Jan 11, 2017
Batch update ACL permissions on AWS.
View aws_acl_updater.rb
# add AWS credentials to ENV variables or modify the script to pass in credentials
require 'thread'
require 'aws-sdk'
# settings
region = 'my-region'
bucket = 'my-bucket'
prefix = 'my-prefix'
acl = "private"
parallel = 25
ostinelli / reloader.rb
Last active Jul 1, 2018
Reload an initializer file on every request in Rails.
View reloader.rb
# add this into application.rb
initializer_file = Rails.root.join('config', 'initializers', 'my_initializer.rb')
reloader =[initializer_file]) do
load initializer_file
ActiveSupport::Reloader.to_prepare do
ostinelli /
Last active Jul 6, 2018
ActiveRecord callback when connection is made

The ConnectionAdapter defines two callbacks :checkout (connect) and :checkin (disconnect).

ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.set_callback :checkout, :after do


ostinelli /
Created Mar 22, 2016
Open iOS simulator directly from console
alias simulator='open /Applications/'
You can’t perform that action at this time.