Skip to content

Instantly share code, notes, and snippets.

sudo apt-get install postgresql-13-postgis-3 postgresql-13-postgis-3-scripts
createdb admin-express
sudo -u postgres psql -d admin-express -c 'CREATE EXTENSION postgis ;'
sudo -u postgres psql -d admin-express -c 'GRANT ALL ON TABLE public.spatial_ref_sys TO david ;'
## Go to <URL: https://geoservices.ign.fr/adminexpress >
## and download ADMIN-EXPRESS_3-2__SHP_LAMB93_FXX_2023-10-16.7z to /data/FTP
cd /data/tmp
7z x /data/FTP/ADMIN-EXPRESS_3-2__SHP_LAMB93_FXX_2023-10-16.7z
cd /data/tmp/ADMIN-EXPRESS_3-2__SHP_LAMB93_FXX_2023-10-16/ADMIN-EXPRESS/1_DONNEES_LIVRAISON_2023-10-16/ADE_3-2_SHP_LAMB93_FXX
ogr2ogr -f postgresql PG:"host=localhost dbname=admin-express" REGION.shp -nlt PROMOTE_TO_MULTI
@Gro-Tsen
Gro-Tsen / x.svg
Created July 24, 2023 09:48
Twitter's new logo that looks suspiciously like U+1D54F MATHEMATICAL DOUBLE-STRUCK CAPITAL X
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#### Plot of cumulative precipitations in France
## Input data: /tmp/precs.csv is expected to contain a list of daily
## precipitations in France (first column = date (unused), second
## column = precipiptations in mm/day). It can be produced from the
## data source described in <URL:
## https://twitter.com/gro_tsen/status/1620435663844970497 > by the
## following command line:
# perl -ne 'next if /^\#/; die unless /^([0-9]{8})\s+(\-?[0-9]+\.[0-9]+(?:[Ee](?:[+-]?[0-9]+))?)\s*$/; printf "%s,%.4f\n", $1,($2+0)' /data/meteo/climexp/iera5_prcp_daily_eu_France_metropolitan.dat > /tmp/precs.csv
19500101 0.0501
19500102 0.4288
19500103 4.4788
19500104 3.0397
19500105 1.0753
19500106 0.7376
19500107 0.0551
19500108 0.0924
19500109 1.5346
19500110 0.3256
#### Some statistical analysis of daily mean temperatures in France
#### See: <URL: https://twitter.com/gro_tsen/status/1620488744867598337 >
## Input data: /tmp/temps.csv is expected to contain a list of daily
## average temperatures in France (first column = date (unused),
## second column = temperature in Celsius), over a whole number of
## calendar years. It can be produced from the data source described
## in <URL: https://twitter.com/gro_tsen/status/1620435663844970497 >
## by the following command line:
19500101 0.7202
19500102 0.6790
19500103 5.4118
19500104 6.8020
19500105 6.4501
19500106 5.4249
19500107 5.0415
19500108 4.9504
19500109 6.3907
19500110 6.5916
/* Compute digits of the (pq)-adic idempotent - David A. Madore, 2014-02-03 */
#include <stdio.h>
#include <string.h>
#include <gmp.h>
#ifndef DIGITS
#define DIGITS 10000000
#endif
## Voir <URL: https://twitter.com/gro_tsen/status/1610641879216914432 > pour le contexte.
## Matrice des contraintes linéaires (la valeur [0] sert à encoder la
## contrainte somme et vaudra 1 sur toute solution, les valeurs [1] à
## [9] sont les cases du tableau avec [1] = nord-ouest, [2] = nord,
## [3] = nord-est, [4] = ouest, [5] = centre, [6] = est, [7] =
## sud-ouest, [8] = sud et [9] = sud-est):
mat = Matrix(ZZ,[(-19,1,1,0,1,1,0,0,0,0),(-19,0,1,1,0,1,1,0,0,0),(-19,0,0,0,1,1,0,1,1,0),(-19,0,0,0,0,1,1,0,1,1)]).transpose()
## Base échelonnée des solutions entières:
## Voir <URL: https://twitter.com/gro_tsen/status/1610641879216914432 > pour le contexte.
## Matrice des contraintes linéaires (la valeur [0] sert à encoder la
## contrainte somme et vaudra 1 sur toute solution, les valeurs [1] à
## [9] sont les cases du tableau avec [1] = nord-ouest, [2] = nord,
## [3] = nord-est, [4] = ouest, [5] = centre, [6] = est, [7] =
## sud-ouest, [8] = sud et [9] = sud-est):
mat = Matrix(ZZ,[(-19,1,1,0,1,1,0,0,0,0),(-19,0,1,1,0,1,1,0,0,0),(-19,0,0,0,1,1,0,1,1,0),(-19,0,0,0,0,1,1,0,1,1),(-45,1,1,1,1,1,1,1,1,1)]).transpose()
## Base échelonnée des solutions entières:
@Gro-Tsen
Gro-Tsen / gettweet.pl
Created January 3, 2023 11:41
Twitter Perl scripts
#! /usr/local/bin/perl -w
# gettweet.pl: Retrieve the content of tweets by id.
# Usage: getweet.pl -i <comma-separated-list>
# saves each in a file called <fulldate>-<id>.txt
# Requires API keys to be stored in ~/.twitterkeys (or $TWITTERKEYS)
# syntax being four lines starting "API-Key: ", "API-Key-Secret: ",
# "Access-Token: " and "Access-Token-Secret: " each followed by their value.