Skip to content

Instantly share code, notes, and snippets.

Jean Boussier byroot

Block or report user

Report or block byroot

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
# See:
sudo rm -f /Library/Preferences/SystemConfiguration/
sudo rm -f /Library/Preferences/SystemConfiguration/
sudo rm -f /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist
sudo rm -f /Library/Preferences/SystemConfiguration/preferences.plist
sudo reboot
byroot@raplh:byroot:$ MISSING_KEY=1 SSHKIT_VERSION=1.10.0 ruby repro-sshkit.rb
Fetching gem metadata from
Fetching version metadata from
Resolving dependencies...
Using net-ssh 3.2.0
Using bundler 1.12.3
Using net-scp 1.2.1
Using sshkit 1.10.0
INFO [a3263e4e] Running /usr/bin/env echo foo as
-- Content of known_hosts file:
View active_record_mysql2_missing_bind_value.rb
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
gemfile(true) do
source ''
# Activate the gem you are reporting the issue against.
View memcache-bench.rb
require 'benchmark/ips'
require 'active_support/cache'
require 'memcached'
require 'active_support/cache/memcached_store'
require 'active_support/cache/dalli_store'
$dalli ='')
$memcached ='')
KEY = 'somekey'
View bench.txt
Calculating -------------------------------------
thread-safe 72.674k i/100ms
thread-safe 2.128M (± 5.8%) i/s - 10.610M
Calculating -------------------------------------
thread-unsafe 109.385k i/100ms
thread-unsafe 5.545M (± 7.9%) i/s - 27.565M
View bench_rails4.0.txt
$ bundle exec ruby per_thread_registry_benchmark.rb
Calculating -------------------------------------
thread-safe 25.176k i/100ms
thread-unsafe 30.069k i/100ms
thread-safe 1.480M (± 6.5%) i/s - 7.377M
thread-unsafe 2.480M (± 7.2%) i/s - 12.328M
View idempotent_counter_cache.rb
module IdempotentCounterCache
module BuilderExtension
def add_counter_cache_callbacks(reflection)
cache_column = reflection.counter_cache_column
foreign_key = reflection.foreign_key
# This skip_callback do not work... may be related to
# model.skip_callback(:destroy, :before, "belongs_to_counter_cache_before_destroy_for_#{name}")
View mysql_boolean_uniqueness.rb
if Rails::VERSION::MAJOR >= 4
if Rails::VERSION::MINOR > 0
ActiveSupport::Deprecation.warn("This patch is probably not useful anymore. Check if have been released.")
class ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter
def type_cast(value, column)
case value
when TrueClass
View wtf.rb
class Foo
def bar(*args)
attribute(:bar, *args)
def attribute(name)
puts name
View convert.rake
desc "convert a latin1 database with utf8 data into proper utf8"
task :convert_to_utf8 => :environment do
dryrun = ENV['DOIT'] != '1'
conn = ActiveRecord::Base.connection
if dryrun
def conn.run_sql(sql)
You can’t perform that action at this time.