Skip to content

Instantly share code, notes, and snippets.

@mazieres
mazieres / FRA_ISO_3166-2.json
Created March 3, 2022 07:11
ISO 3166-2 FRANCE JSON
View FRA_ISO_3166-2.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
View MAP_FRA_ISO_3166-2.svg
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
View FRA_ISO_3166-2.csv
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
View ISO 3166-2:FR_departements.csv
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
View ISO 3166-2:FR_regions.csv
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
View remember.py
#!/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())]
View keybase.md

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 November 11, 2022 08:33
Python companion to the work described here : https://mazieres.gitlab.io/namograph/index.html
View namograph.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View flatten.py
def flatten(li):
return [item for sublist in li for item in sublist]
View progressbar.py
import progressbar
i = 0
with progressbar.ProgressBar(max_value=len(entities)) as bar:
for entity in entities:
compute_metrics(entity)
i += 1
bar.update(i)