Skip to content

Instantly share code, notes, and snippets.

@mazieres
mazieres / namograph-diy.ipynb
Created June 21, 2023 06:19
A simple example of the use of the Namograph -- https://mazieres.gitlab.io/namograph/index.html
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mazieres
mazieres / FRA_ISO_3166-2.json
Created March 3, 2022 07:11
ISO 3166-2 FRANCE JSON
{
"FR-01": {
"parent_subdiv": "FR-ARA",
"subdiv_name": "Ain",
"subdiv_type": "d\u00e9partement m\u00e9tropolitain"
},
"FR-02": {
"parent_subdiv": "FR-HDF",
"subdiv_name": "Aisne",
"subdiv_type": "d\u00e9partement m\u00e9tropolitain"
@mazieres
mazieres / MAP_FRA_ISO_3166-2.svg
Last active March 2, 2022 10:39
SVG Map of France with most of ISO_3166-2 subdivisions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mazieres
mazieres / FRA_ISO_3166-2.csv
Created March 2, 2022 06:29
ISO 3166-2 FRA
subdiv_type iso_3166-2 subdiv_name parent_subdiv
département métropolitain FR-01 Ain FR-ARA
département métropolitain FR-02 Aisne FR-HDF
département métropolitain FR-03 Allier FR-ARA
département métropolitain FR-06 Alpes-Maritimes FR-PAC
département métropolitain FR-04 Alpes-de-Haute-Provence FR-PAC
collectivité européenne FR-6AE Alsace FR-GES
département métropolitain FR-08 Ardennes FR-GES
département métropolitain FR-07 Ardèche FR-ARA
département métropolitain FR-09 Ariège FR-OCC
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
FR-01;Ain;metropolitan department
FR-02;Aisne;metropolitan department
FR-03;Allier;metropolitan department
FR-04;Alpes-de-Haute-Provence;metropolitan department
FR-06;Alpes-Maritimes;metropolitan department
FR-07;Ardèche;metropolitan department
FR-08;Ardennes;metropolitan department
FR-09;Ariège;metropolitan department
FR-10;Aube;metropolitan department
FR-11;Aude;metropolitan department
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
FR-ARA;Auvergne-Rhône-Alpes;metropolitan region
FR-BFC;Bourgogne-Franche-Comté;metropolitan region
FR-BRE;Bretagne;metropolitan region
FR-CVL;Centre-Val de Loire;metropolitan region
FR-20R;Corse;metropolitan collectivity with special status
FR-GES;Grand-Est;metropolitan region
FR-GP;Guadeloupe;overseas region
FR-GF;Guyane (française);overseas region
FR-HDF;Hauts-de-France;metropolitan region
FR-IDF;Île-de-France;metropolitan region
#!/usr/bin/env python3
import subprocess
def cli(cmd_str):
process = subprocess.Popen(cmd_str, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
output, error = process.communicate()
output, error = [x if len(x) > 0 else None
for x in (output.decode().strip(), error.decode().strip())]

Keybase proof

I hereby claim:

  • I am mazieres on github.
  • I am mazieres (https://keybase.io/mazieres) on keybase.
  • I have a public key whose fingerprint is 5C72 B759 A3D8 F135 0B23 A459 8356 48CC 0077 40FD

To claim this, I am signing this object:

@mazieres
mazieres / namograph.ipynb
Last active June 21, 2023 06:29
Python companion to the work described here : https://mazieres.gitlab.io/namograph/index.html
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def flatten(li):
return [item for sublist in li for item in sublist]