Skip to content

Instantly share code, notes, and snippets.

@RomainTT
RomainTT / csv-schema.lark
Last active December 31, 2021 11:21
Lark file for CSV schema v1.2
// RULES // ----- schema : prolog body
prolog : versiondecl globaldirectives versiondecl : ("version 1.0" | "version 1.1" | "version 1.2")
globaldirectives : separatordirective? quoteddirective? totalcolumnsdirective? permitemptydirective? (noheaderdirective | ignorecolumnnamecasedirective)? directiveprefix : "@"
separatordirective : directiveprefix "separator" (separatortabexpr | separatorchar)
separatortabexpr : "tab" | "\t"
separatorchar : CHARACTERLITERAL
quoteddirective : directiveprefix "quoted"
totalcolumnsdirective : directi
@RomainTT
RomainTT / docker-notes.md
Last active June 21, 2021 09:52
Notes Docker

Pour lister les volumes montés par chaque conteneur :

docker ps -a --format '{{ .ID }}' | xargs -I {} docker inspect -f '{{ .Name }}{{ printf "\n" }}{{ range .Mounts }}{{ printf "\n\t" }}{{ .Type }} {{ if eq .Type "bind" }}{{ .Source }}{{ end }}{{ .Name }} => {{ .Destination }}{{ end }}{{ printf "\n" }}' {}

Pour qu’un conteneur ait la même timezone que son hôte :

@RomainTT
RomainTT / python-notes.md
Created February 21, 2019 14:48
Python notes

This file is used to store some tips and tricks I collect while programming in Python.

Native Python

Finding a substring within a list in Python

When a single string is looked for in a list of strings by providing a sub-string, here is the solution with the lowest execution time:

s = next((s for s in slist if subs in s), None)