Skip to content

Instantly share code, notes, and snippets.

View leblancfg's full-sized avatar

François Leblanc leblancfg

View GitHub Profile
@leblancfg
leblancfg / tableau_10.scss
Created October 6, 2020 13:41
Tableau 10 Color Palette Hex Codes
// Tableau 10 color theme
$themes: (
blue: #5778a4,
orange: #e49444,
red: #d1615d,
teal: #85b6b2,
green: #6a9f58,
yellow: #e7ca60,
purple: #a87c9f,
pink: #f1a2a9,
@leblancfg
leblancfg / pg_password.sh
Created May 29, 2020 13:58
Get PostgreSQL password from json with URL connection string - one-liner
cat FILENAME.json | jq '.KEY' | sed 's/.*postgres:\(.*\)@.*/\1/'
@leblancfg
leblancfg / pandoc_bootstrap_template.sh
Last active January 9, 2020 13:44
Bash alias to create an HTML file from Markdown with a Bootstrap template. Save the template.* files to ~/Templates, paste the function in your bash_profile.
# Paste this in your ~/.bashrc or ~/.bash_profile
function panstrap () {
# Usage: panstrap input_file output_file
DIR="$HOME/Templates"
if [ "$#" -eq 2 ]
then
pandoc "$1" -o "$2" --template $DIR/template.html --css $DIR/template.css --self-contained --toc --toc-depth 2
elif [ "$#" -eq 1 ]
then
filename=$(basename -- "$1")
@leblancfg
leblancfg / synonyms.sh
Last active February 27, 2018 18:53
Synonyms CLI - Query a word's synonyms directly from terminal
# Always feeling like I'm repreating myself when writing prose,
# but forcing myself to stay in terminal
# Usage: syn $WORD, e.g. `syn car`
# Output: ['motor', 'automotive', 'cart']
# Requirements: Python 3+, pip install vocabulary
function syn () { python -c "import json;from pprint import pprint;from vocabulary.vocabulary import Vocabulary as vb;syns = json.loads(vb.synonym('$@'));pprint([s['text'] for s in syns]);" ; }
@leblancfg
leblancfg / postgis_example.sql
Last active January 5, 2018 21:04
Minimal PostGIS example
/*
Minimal example used to test that PostGIS extention is installed on Postgres.
Run with: psql -U $USERNAME -d $GEODB -p $PORT -f postgis_example.sql
Should return:
'''
id | geometry
----+--------------
2 | POINT(30 30)
(1 row)
'''
@leblancfg
leblancfg / export_tables_to_utf8_csv.vba
Created January 5, 2018 19:55
Export all MS Access tables to UTF-8 CSVs
' This script will export all tables in its MS Access db to UTF-8 CSVs
' -----
' The macro can then be run from the command line as:
' C:\path\to\Msaccess.exe "C:\path\to\database.accdb" /x "MACRO NAME"
Sub ExportTablesToCSV()
Const MyPath = "C:\ExportedTables\"
Dim db
Dim tdf
Dim objXl
@leblancfg
leblancfg / install_postgis.sh
Last active January 5, 2018 16:21
Installing PostGIS on MinGW / Cygwin
# leblancfg, 4.01.2018
# This script downloads the latest postgreSQL and postGIS
# Windows binaries and installs them embedded, i.e. without admin privileges.
# -----------------
# For use with MinGW and Cygwin,
# Not tested. Use at your own risk.
# See https://gis.stackexchange.com/questions/41060/how-to-install-postgis-On-windows
SQLFN=postgresql-10.1-3-windows-x64-binaries.zip
GISFN=postgis-bundle-pg10-2.4.2x64.zip