Skip to content

Instantly share code, notes, and snippets.

View whyvez's full-sized avatar

Yves Richard whyvez

View GitHub Profile
@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 / bashstyle.md
Created August 14, 2018 19:46 — forked from outro56/bashstyle.md
Bash scripting best practices (copied from https://github.com/progrium/bashstyle/blob/master/README.md)

progrium/bashstyle

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
whyvez / xyz_vs_tms.md
Created May 13, 2016 14:55 — forked from tmcw/xyz_vs_tms.md
The difference between XYZ and TMS tiles and how to convert between them

The difference between XYZ and TMS tiles and how to convert between them

Lots of tile-based maps use either the XYZ or TMS scheme. These are the maps that have tiles ending in /0/0/0.png or something. Sometimes if it's a script, it'll look like &z=0&y=0&x=0 instead. Anyway, these are usually maps in Spherical Mercator.

Good examples are OpenStreetMap, Google Maps, MapBox, MapQuest, etc. Lots of maps.

Most of those are in XYZ. The best documentation for that is slippy map tilenames on the OSM Wiki, and Klokan's Tiles a la Google.

@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'
@whyvez
whyvez / shoot.sh
Created November 9, 2015 22:54 — forked from zmpeg/shoot-osx.sh
shoot
#!/bin/bash
#
# Takes a screenshot, puts the URL in your clipboard,
# Then syncronizes the screenshot to your configured host
LOCALDIR="$HOME/documents/screenshots/"
REMOTEHOST="mjz.me"
REMOTEDIR="/home/matt/public/mjz.me/public/s/"
TIMESTAMP=`date +%s`
WEBHOST="http://mjz.me/s/"
@whyvez
whyvez / backup
Last active August 29, 2015 14:24
#!/bin/bash
SERVER=yourwebsite.com
tar -cjf- ~/.crypt/passwd ~/.ssh ~/.bashrc ~/.profile ~/.vimrc ~/.gitconfig \
~/.config/chromium ~/.mozilla \
| openssl enc -aes-256-cbc \
| ssh $SERVER 'cat>~/www/backup/`date +%F.%T`'
ssh $SERVER 'ls -1 ~/www/backup | grep ^[0-9] | sort > ~/www/backup/list.txt'
#!/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
-- API --
validate_upload(upload_id) --inserts from get_upload_violations
exec delete_duplicates()upload_id -- iterate through eacj onValidate
insert from get_upload_violations(upload_id) into violations -- query on all rules without insert
delete_upload()
-- API --
validate_upload(upload_id) --inserts from get_upload_violations
exec delete_duplicates()upload_id -- iterate through eacj onValidate
insert from get_upload_violations(upload_id) into violations -- query on all rules without insert
delete_upload()
@whyvez
whyvez / avca_regions
Last active August 29, 2015 14:06 — forked from benshaw/avca_regions
{
"regions": {
"Banff Yoho Kootenay": {
"display": "Banff, Yoho and Kootenay National Parks",
"url": "http://avalanche.pc.gc.ca/CAAML-eng.aspx?d=TODAY&r=1",
"type": "parks"
},
"Glacier": {
"display": "Glacier National Park",
"url": "http://avalanche.pc.gc.ca/CAAML-eng.aspx?d=TODAY&r=3",