Skip to content

Instantly share code, notes, and snippets.

View ThomasG77's full-sized avatar

Thomas Gratier ThomasG77

View GitHub Profile
@datagistips
datagistips / restaurants.sql
Last active July 16, 2024 07:33
Rechercher les restaurants à 5 minutes à pied de chez soi avec DuckDB, la BAN, OvertureMaps et Isochrone IGN
load spatial;
-- point (adresse)
-- Ex. 34+bis+avenue+philippe+solari
-- Utilisation de la BAN
create or replace table point as (
with a as (select unnest(features, recursive:=true) from read_json_auto(format('https://api-adresse.data.gouv.fr/search/?q={}', '34+bis+avenue+philippe+solari')))
select st_point(coordinates[1], coordinates[2]) as geom from a
);
@rastandy
rastandy / solutions-json.php
Last active October 1, 2024 13:31
A Wordpress page template for obtaining a GeoJSON file from a list of posts with custom fields
<?php
/*
Template Name: Solutions JSON
*/
header( 'Content-Type: application/geo+json' . '; charset=' . get_option( 'blog_charset' ), true );
$more = 1;
echo '{"type": "FeatureCollection", "features": [';
@ThomasG77
ThomasG77 / .eslintrc.json
Last active April 18, 2022 23:24
Play with gdal.vectorTranslate in Node.js
{
"env": {
"node": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
Loading
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 June 8, 2023 14:27
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/)
/**
* 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 May 12, 2024 14:24
Using a javascript proxy as low code REST client
/* 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) {
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 December 15, 2021 15:09
Example of Python aliases + reimplementation of `cd` to auto de/activate the current virtualenv
# 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'
@yokawasa
yokawasa / ghcr.md
Last active October 14, 2024 13:38
ghcr (GitHub Container Registry)

ghcr (GitHub Container Registry) quickstart

CLI

To push container images to ghcr, you need peronal access token (PAT) - see how to create PAT

  1. Get PAT (personal access token)

Personal Settings > Developer settings > Personal access tokens