Skip to content

Instantly share code, notes, and snippets.

HTTP/1.1 200
content-type: text/plain
vary: Accept-Encoding
x-request-id: ctes5cd3wt8tjd45cj9c99z1eh
content-length: 2
date: Wed, 15 Mar 2023 10:39:17 GMT
bfontaine /
Last active May 9, 2022 14:03
Fix g++-5 error when installing eventmachine or sassc gems

Ok this is ugly but it fixes the issue and I haven’t found a better solution.

You have to have g++ installed. Then make a symlink from g++-5 to g++:

cd /usr/bin
sudo ln -s $(which g++) g++-5

And try bundle install again.

bfontaine / code_golf.awk
Last active December 8, 2021 08:46
Awk code-golf tips
# save 1 char by using 'for' instead of 'while'
# save 1 char by using a missing variable instead of ""
# use ternary operations when possible
if(c)a else b
bfontaine /
Last active October 25, 2020 20:21
Install Gephi on OS X
  1. Install Homebrew:

     ruby -e "$(curl -fsSL"
  2. Download Java 6 on this page and install it

  3. Install Gephi:

     brew cask install gephi
bfontaine / har2etc.jq
Last active August 24, 2020 10:25
Extract cookies off a .har file and export them for the EditThisCookie browser extension for testing purposes
# HAR to EditThisCookie converter
def domain:
| sub("^https?://"; "")
| sub("/.*"; "");
def cookies:
domain as $d
| .cookies|map(. + {"domain": $d,
#! /bin/bash -e
# This is a tool to vertically stitch together screenshots of black and white
# scans.
# Install:
# brew cask install hugin
bfontaine /
Last active November 16, 2019 13:51
Solution to Advent of Code 2018 problem 7.1 in Python3 in 163 chars. Your input file must be named "T".
for L in open("T"):a,b=L[5::31];G={a:set(),**G};G[b]=G.get(b,{a})|{a}
while G:C=min(c for c in G if not G[c]);G={c:G[c]-{C}for c in G if c!=C};print(C,end="")

Estimate the number of lines in a large file

Get the size of the file:

$ wc -c myfile.jsons
104431233268 myfile.jsons

Then pipe it through head to take only e.g. 1/1000th of the file:

Keybase proof

I hereby claim:

  • I am bfontaine on github.
  • I am bfontaine ( on keybase.
  • I have a public key ASAbQaOETWTGegk7J5bi8AaCgRwog0wUtbAarRRH4cL_Jwo

To claim this, I am signing this object:


"test" =~ s/(.*)$/\1s/gr # => "testss

Ruby (same engine as Perl):

"test".gsub(/(.*)$/, "\\1s") # => "testss"