Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Gratier ThomasG77

View GitHub Profile
View opentopo_tiles.md
@ThomasG77
ThomasG77 / .eslintrc.json
Last active Apr 18, 2022
Play with gdal.vectorTranslate in Node.js
View .eslintrc.json
{
"env": {
"node": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
View philly_sjoin.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mmazzarolo
mmazzarolo / runtime-globals-checker.js
Last active Jul 23, 2022
Find what JavaScript variables are leaking into the global `window` object at runtime (see: https://mmazzarolo.com/blog/2022-02-14-find-what-javascript-variables-are-leaking-into-the-global-scope/)
View runtime-globals-checker.js
/**
* RuntimeGlobalsChecker
*
* You can use this utility to quickly check what variables have been added (or
* leaked) to the global window object at runtime (by JavaScript code).
* By running this code, the globals checker itself is attached as a singleton
* to the window object as "__runtimeGlobalsChecker__".
* You can check the runtime globals programmatically at any time by invoking
* "window.__runtimeGlobalsChecker__.getRuntimeGlobals()".
*
@DavidWells
DavidWells / javascript-proxy-as-rest-client.js
Last active Aug 7, 2022
Using a javascript proxy as low code REST client
View javascript-proxy-as-rest-client.js
/* Using a JavaScript proxy for a super low code REST client */
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3
// also see https://github.com/fastify/manifetch
// also see https://github.com/flash-oss/allserver
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {
View pyqgis-manipulate-ogc-services.py
import re
import csv
import ssl
import urllib.request
ssl._create_default_https_context = ssl._create_unverified_context
baseUrl = 'https://geoservices.ign.fr/'
url_page = baseUrl + 'documentation/services'
@davidbgk
davidbgk / .zshrc
Created Dec 15, 2021
Example of Python aliases + reimplementation of `cd` to auto de/activate the current virtualenv
View .zshrc
# aliases
alias -g ll='ls -al'
alias -g subl='open -a "Sublime Text"'
alias server='python3 -m http.server 8000 --bind 127.0.0.1'
alias rmvenv='deactivate && rm -rf venv/'
alias venv='python3 -m venv venv'
alias activate='source venv/bin/activate'
alias pipupgrade='python3 -m pip install --upgrade pip'
alias requirements='python3 -m pip install -r requirements.txt'
@mdouchin
mdouchin / AuditQGISProjects.py
Last active Oct 6, 2021
Audit the QGIS projects found in a directory and it sub-directories, and export a CSV file containing the fetched information
View AuditQGISProjects.py
# -*- coding: utf-8 -*-
"""
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
@0xabad1dea
0xabad1dea / copilot-risk-assessment.md
Last active Jul 10, 2022
Risk Assessment of GitHub Copilot
View copilot-risk-assessment.md

Risk Assessment of GitHub Copilot

0xabad1dea, July 2021

this is a rough draft and may be updated with more examples

GitHub was kind enough to grant me swift access to the Copilot test phase despite me @'ing them several hundred times about ICE. I would like to examine it not in terms of productivity, but security. How risky is it to allow an AI to write some or all of your code?

Ultimately, a human being must take responsibility for every line of code that is committed. AI should not be used for "responsibility washing." However, Copilot is a tool, and workers need their tools to be reliable. A carpenter doesn't have to

@s-m-e
s-m-e / mptest.py
Last active Aug 22, 2021
multiprocessing pool test, process-based and thread-based
View mptest.py
# -*- coding: utf-8 -*-
# QGIS 3.x / Python 3.x
from math import sqrt, ceil
from multiprocessing import Pool, Process, Queue
from multiprocessing.pool import ThreadPool
WORKERS = 2
def worker_task(number):