Skip to content

Instantly share code, notes, and snippets.

View thbar's full-sized avatar

Thibaut Barrère thbar

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thbar
thbar / _readme.md
Last active July 17, 2024 18:54
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
thbar / Flexible Dockerized Phoenix Deployments.md
Created August 30, 2018 16:42 — forked from jswny/Flexible Dockerized Phoenix Deployments.md
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

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

@thbar
thbar / notes.md
Last active July 11, 2018 11:48
Little things about JRuby heap size

Verifying the current JRuby max heap size

I think I'm able to measure the max heap using this code:

# size in bytes
jruby -e "puts java.lang.management.ManagementFactory.memory_mx_bean.heap_memory_usage.max"

Tweaking & measuring

function onPageRequest(req, res) {
res.writeHead(200, {
'Content-Type': 'application/json',
"Access-Control-Allow-Origin": "*"
});
res.end(JSON.stringify(
{
@thbar
thbar / config.yml
Created May 2, 2018 15:40
A CircleCI v2 config file (here using docker + JRuby image)
version: 2
jobs:
build:
docker:
# https://circleci.com/docs/2.0/circleci-images/#jruby
# TODO: DRY version number with .ruby-version once we
# have a solution. See discussion at:
# https://discuss.circleci.com/t/setting-docker-image-version-based-on-ruby-version/22119
- image: circleci/jruby:9.1.14.0
environment:
@thbar
thbar / ansible-bootstrap-ubuntu-16.04.yml
Created April 25, 2018 13:21 — forked from gwillem/ansible-bootstrap-ubuntu-16.04.yml
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# [email protected]
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
[2018-02-03 20:14:23] run_gem_wrappers_regenerate
run_gem_wrappers_regenerate ()
{
gem_install gem-wrappers && gem wrappers regenerate || return $?
}
current path: /Users/thbar
GEM_HOME=/Users/thbar/.rvm/gems/ext-truffleruby-0.30.2@global
PATH=/Users/thbar/.rvm/gems/ext-truffleruby-0.30.2@global/bin:/Users/thbar/.rvm/rubies/ext-truffleruby-0.30.2/bin:/Users/thbar/.rvm/bin:/Users/thbar/.cargo/bin:/Users/thbar/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/Versions/latest/bin
GEM_PATH=/Users/thbar/.rvm/gems/ext-truffleruby-0.30.2@global
command(1): run_gem_wrappers_regenerate
@thbar
thbar / confirm_link.coffee
Last active January 10, 2018 09:53
How to display a confirmation popup before redirecting to another site
@thbar
thbar / gist:f66a28fbeddd84391663451236d30150
Created December 8, 2017 10:34 — forked from n00neimp0rtant/gist:9515611
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname