Skip to content

Instantly share code, notes, and snippets.

View FGRibreau's full-sized avatar
✍️
writing "#NoBullshit Tech-Lead" book https://getnobullshit.com

Francois-Guillaume Ribreau FGRibreau

✍️
writing "#NoBullshit Tech-Lead" book https://getnobullshit.com
View GitHub Profile
### Keybase proof
I hereby claim:
* I am FGRibreau on github.
* I am fgribreau (https://keybase.io/fgribreau) on keybase.
* I have a public key whose fingerprint is 5C44 FB61 55CB 31BF 8CD7 9ED7 BD7F 1108 C2C8 5857
To claim this, I am signing this object:
@FGRibreau
FGRibreau / HeaderValueExt.rs
Last active September 29, 2023 16:15
Convert a HeaderValue into a rust String
/// Additional conversion methods for `HeaderValue`.
pub trait HeaderValueExt {
fn to_string(&self) -> String;
}
impl HeaderValueExt for HeaderValue {
fn to_string(&self) -> String {
self.to_str().unwrap_or_default().to_string()
}
}
@FGRibreau
FGRibreau / keycloak-route-patterns-to-keep-open.txt
Created February 8, 2020 11:55
Minimal Keycloak route patterns to keep open (whitelist)
/auth/realms/<realm>/protocol/openid-connect/token
/auth/realms/<realm>/protocol/openid-connect/logout
/auth/realms/<realm>/protocol/openid-connect/auth
/auth/realms/<realm>/login-actions/first-broker-login
/auth/realms/<realm>/broker/after-first-broker-login
@FGRibreau
FGRibreau / 1_stripe-schema.md
Last active March 8, 2024 14:57
Stripe database schema (extracted from their sigma product) as of 2019-10-09
jqn -r markdown-table 'map(x => "## " + x.name + "\n\n" + markdownTable(x.columns.map(y => [y.name, y.type]))  ) | join("\n\n")' < /tmp/stripe.json

accounts

id varchar
business_name varchar
business_url varchar
@FGRibreau
FGRibreau / cors-nginx.conf
Last active May 26, 2020 11:06 — forked from alexjs/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
@FGRibreau
FGRibreau / GCLOU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kQTQrTlBvNktwa0phMldWOEkv
@FGRibreau
FGRibreau / PostgresToSNSWorker.js
Created March 4, 2017 20:39
PostgresToSNSWorker
// Basic PostgresToSNSWorker worker
const pg = require ('pg');
const pgConString = process.env.POSTGRESQL_CONNECTIONSTRING;
pg.connect(pgConString, function(err, client) {
if(err) {
console.log(err);
}
client.on('notification', function(msg) {
@FGRibreau
FGRibreau / build.sh
Last active January 30, 2017 11:42
Moving our CI from npm to yarn, fresh install performance http://blog.fgribreau.com/2017/01/how-we-reduced-by-37-our-nodejs-project.html
time docker run --rm -v $(pwd):/src mkenney/npm npm install
12:04:14 real 3m33.500s
12:04:14 user 0m0.780s
12:04:14 sys 0m0.716s
time docker run --rm -v $(pwd):/workspace kkarczmarczyk/node-yarn yarn install
12:07:29 real 2m0.769s
12:07:29 user 0m0.164s
@FGRibreau
FGRibreau / circle.yml
Last active April 5, 2017 09:00
Cargo rust test for CircleCI
machine:
services:
- docker
test:
override:
# don't forget to replace "1.18" with your rust version
- docker run -it --rm -v $(pwd):/source -w /source scorpil/rust:1.18 cargo test
@FGRibreau
FGRibreau / iterator_tail.rs
Last active January 27, 2017 17:41
tail() for Rust iterators
use std::iter::FromIterator;
trait ExtendedIterator: Iterator {
fn tail<B>(&mut self) -> B where B:FromIterator<Self::Item>, Self::Item: Eq + Clone, Self: Sized{
self.skip(1).collect::<B>()
}
}
impl<I> ExtendedIterator for I where I: Iterator {}