Skip to content

Instantly share code, notes, and snippets.

Thibaut Barrère thbar

Block or report user

Report or block thbar

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
thbar /
Created Jul 12, 2019
Installing MySQL2 on Mac OS X Mojave (2019 edition)

mysql2 install failing on Mac OS X (Mojave)

If you want to install the gem (client) without having a database, doing brew install mysql-connector-c used to work, but not anymore.

You now have to install a compatible connector (mariadb):

brew install mariadb-connector-c
bundle config build.mysql2 "--with-mysql-config=$(brew info mariadb-connector-c | grep /usr/local | cut -d ' ' -f 1)/bin/mariadb_config"
bundle install
thbar / s3-updater.rb
Created Jul 5, 2019 — forked from mattboldt/s3-updater.rb
Update S3 object metadata of an entire bucket using the AWS Ruby SDK
View s3-updater.rb
require 'aws-sdk'
require 'active_support'
require 'active_support/core_ext'
COPY_TO_OPTIONS = [:multipart_copy, :content_length, :copy_source_client, :copy_source_region, :acl, :cache_control, :content_disposition, :content_encoding, :content_language, :content_type, :copy_source_if_match, :copy_source_if_modified_since, :copy_source_if_none_match, :copy_source_if_unmodified_since, :expires, :grant_full_control, :grant_read, :grant_read_acp, :grant_write_acp, :metadata, :metadata_directive, :tagging_directive, :server_side_encryption, :storage_class, :website_redirect_location, :sse_customer_algorithm, :sse_customer_key, :sse_customer_key_md5, :ssekms_key_id, :copy_source_sse_customer_algorithm, :copy_source_sse_customer_key, :copy_source_sse_customer_key_md5, :request_payer, :tagging, :use_accelerate_endpoint]
region: 'us-east-1',
credentials:, AWS_SECRET_KEY)
thbar / main.workflow
Created Jan 14, 2019 — forked from jhawthorn/main.workflow
GitHub actions workflow for my static site for more
View main.workflow
workflow "Build and deploy on push" {
on = "push"
resolves = [
"Branch master",
"Invalidate cache",
action "Build" {
uses = "docker://ruby:latest"
View puzzle_04.ex
defmodule AdventOfCode2018.Puzzle04 do
def match(a, b) do
length = String.length(a)
# reversed Jaro distance formula for
# 1 transposition and length -1 matching characters
# on two "length" sized strings
# I added some large epsilon tolerance to make this work :-)
abs((String.jaro_distance(a, b) * 3 - 2 * (length - 1) / length) - 1.0) < 0.1
thbar / deploy.rb
Created Nov 14, 2018
View deploy.rb
set :rvm_ruby_version do
after 'deploy:updating', 'custom:tweak_ruby_version' do
ruby_version = fetch(:override_rvm_ruby_version, nil)
next unless ruby_version
on roles :all do
info "Overwriting .ruby-version with #{ruby_version.inspect}"
content =
thbar / phoenix_to_umbrella
Created Oct 30, 2018 — forked from emilsoman/phoenix_to_umbrella
How to move an existing phoenix app under an umbrella app
View phoenix_to_umbrella
How to convert existing phoenix app to an umbrella app.
chrismccord [10:14 PM]
@alanpeabody yes, it's straightforward
1) mix new my_umbrella --umbrella
View JMW Home Temps.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
thbar /
Last active Mar 16, 2019
Using minitest to regression test your Jekyll static site

Using minitest to regression-test your Jekyll static site

I recently had to upgrade my blog, which involved changes such as:

  • Replacing a sitemap plugin
  • Upgrading from jekyll 2.5.3 to 3.8.4
  • Upgrading from jekyll-assets 0.7.8 to 3.0.11
  • (etc)

The upgrading process was not trivial, and some parts (e.g. RSS, sitemap, or twitter cards tags) are not immediately visible, so I decided to add unit tests on the generated content.

thbar / Flexible Dockerized Phoenix
Created Aug 30, 2018 — forked from jswny/Flexible Dockerized Phoenix
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.
View Flexible Dockerized Phoenix


I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

You can’t perform that action at this time.