Skip to content

Instantly share code, notes, and snippets.

View whyvez's full-sized avatar

Yves Richard whyvez

View GitHub Profile
#!/bin/bash
#
# Script to setup a Elastic Beanstalk AMI with geospatial libraries and postGIS
#
# sh aws_ami_prep.sh > aws_ami_prep.log 2>&1 &
# Go to ec2-user home directory
cd /home/ec2-user
# yum libraries
@whyvez
whyvez / install-gm-w-librvg.sh
Last active February 15, 2023 23:01
Installs ImageMagick --with-librsvg on Amazon Linux
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib/pkgconfig
export PATH=/usr/bin:$PATH
export LDFLAGS=-L/usr/lib64:/usr/lib
export LD_LIBRARY_PATH=/usr/lib64:/usr/lib
export CPPFLAGS=-I/usr/include
sudo yum-config-manager --enable epel
#sudo yum update -y
sudo yum install -y gcc gcc-c++ glib2-devel.x86_64 libxml2-devel.x86_64 libpng-devel.x86_64 \
libjpeg-turbo-devel.x86_64 gobject-introspection.x86_64 gobject-introspection-devel.x86_64
@whyvez
whyvez / README.md
Last active August 2, 2022 02:15
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.
apiVersion: my.org.com/v1beta1
kind: WorkloadIdentityUser
metadata:
@whyvez
whyvez / install-psycopg2.sh
Last active July 13, 2022 02:58
install psycopg2 on aws linux
sudo yum install gcc python27 python27-devel postgresql-devel
sudo curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python27
sudo /usr/bin/easy_install-2.7 pip
sudo pip2.7 install psycopg2
@whyvez
whyvez / handler.js
Created August 21, 2015 17:35
lambda container reuse state issue
/*
The current container reuse strategy in AWS Lambda makes it very hard to ensure consistent environments between invocations.
Managing environments is currently the responsibility of the user. There should be some additional cleanup tasks ran after
an invocation to ensure at least a freah new nodejs context. As an example I added the setInterval issue we've seen.
*/
// new container a
// * invocation 1 on container a
// - using setInterval to check remaining time every 1 sec
@whyvez
whyvez / csvjson.awk
Last active October 1, 2020 16:25
Simple awk csv to ndjson converter.
BEGIN {
FPAT = "([^,]*)|(\"[^\"]+\")"
}
NR == 1 {
split($0, header, ",")
}
NR > 1 {
@whyvez
whyvez / firebase_pre-request_script.js
Created September 3, 2020 15:03 — forked from moneal/firebase_pre-request_script.js
Postman pre-request script to create a Firebase authentication JWT header.
/**
* 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 https://securetoken.googleapis.com/v1/token 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
whyvez / README.md
Last active July 22, 2020 19:56
OSM Planet PBF to PostgreSQL loader on GCP

osm-loader

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/install.sh)
  • Copies src/load.sh to instance.

Usage:

@whyvez
whyvez / index.js
Last active June 5, 2020 13:42
Gable board calculator.
#!/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()];
arr.shift();
@whyvez
whyvez / gist:2bf7f8bc6074f026055d
Created February 12, 2016 21:58 — forked from fonnesbeck/gist:71fb84319d33e3227e87
Installing rpy2 against Homebrew R
env LDFLAGS="-L/usr/local/Cellar/r/3.1.0/R.framework/Versions/3.1/Resources/lib -L/usr/local/opt/openblas/lib" \
python setup.py build
python setup.py install
python -m 'rpy2.tests'