Skip to content

Instantly share code, notes, and snippets.


Yves Richard whyvez

View GitHub Profile
whyvez /
Last active Aug 2, 2022
Kustomize GKE Workload Identity Plugin

Kustomize GKE Workload Identity Plugin

  • Creates iam.workloadIdentityUser bindings for each IAMServiceAccount.
  • Creates iam.workloadIdentityUser bindings for each external SA defined in spec.
  • Annotates KSA that matches with each GSA from internal and external referenced GSA.
kind: WorkloadIdentityUser
whyvez / csvjson.awk
Last active Oct 1, 2020
Simple awk csv to ndjson converter.
View csvjson.awk
FPAT = "([^,]*)|(\"[^\"]+\")"
NR == 1 {
split($0, header, ",")
NR > 1 {
whyvez / firebase_pre-request_script.js
Created Sep 3, 2020 — forked from moneal/firebase_pre-request_script.js
Postman pre-request script to create a Firebase authentication JWT header.
View firebase_pre-request_script.js
* This script expects the global variables 'refresh_token' and 'firebase_api_key' to be set. 'firebase_api_key' can be found
* in the Firebase console under project settings then 'Web API Key'.
* 'refresh_token' as to be gathered from watching the network requests to from
* your Firebase app, look for the formdata values
* If all the data is found it makes a request to get a new token and sets a 'auth_jwt' environment variable and updates the
* global 'refresh_token'.
* Requests that need authentication should have a header with a key of 'Authentication' and value of '{{auth_jwt}}'
whyvez /
Last active Jul 22, 2020
OSM Planet PBF to PostgreSQL loader on GCP


Small utility that loads OSM planet data into PosgresSQL.

Utility does the following:

  • Creates GCP instance with 4 SSD (1.5TB)
  • Bootstraps instance with dependencies (src/
  • Copies src/ to instance.


whyvez / index.js
Last active Jun 5, 2020
Gable board calculator.
View index.js
#!/usr/bin/env node
const gabbleWidth = 22*12;
const boardCoverage = 6.375;
const boardLength = 144;
const nBoards = Math.ceil(gabbleWidth/boardCoverage);
const narray = (n, v) => {
let arr = [...Array(Math.ceil(n+1)).keys()];
whyvez /
Last active Aug 29, 2018
Deletes all AWS CloudFormation stacks - USE WITH CAUTION!
aws cloudformation list-stacks | jq -r '.[][].StackName' | while read -r stack_name; do
aws cloudformation delete-stack --stack-name "${stack_name}"
echo "deleted stack ${stack_name}"


Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne

whyvez /
Created May 31, 2018
maps each layer in input file into separate GeoJSON file
#!/usr/bin/env bash
# desc: maps each layer in input file into separate GeoJSON file
# usage: ./split human_footprint.gdb
# dep: gdal, awk, parallel
ogrinfo "$input" \
| awk '{if (NR > 2) print $2}' \
whyvez /
Last active Nov 18, 2017
CircleCi ElasticBeanstalk deploy
#!/usr/bin/env bash
# DEPLOYMENT_BUCKET=your-deployement-bucket APPLICATION_NAME=your-application-name ENVIRONMENT_NAME=your-environment-name bash ./
commit_sha=$(git rev-parse HEAD)
zip -r -x=*node_modules* -x=*.git* $bundle_name * .[^.]*
whyvez / jtf.js
Created Oct 21, 2017
Simple example of a JavaScript based Terraform pre-processor using tagged template literal
View jtf.js
function resource (literals, func) {
console.log(`resource ${literals[0]} ${func()} ${literals[1]}`);
function ip_set_descriptors (literals, func) {
return `ip_set_descriptors ${literals[0]} ${func()} ${literals[1]}`;
const ips = ['', ''];