This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import reduce | |
class string(str): | |
def __ladd__(self, other): | |
other = other or "" | |
return reduce(str.__add__,("L" , self , "L+" , "R" , other)) | |
def __radd__(self, other): | |
other = other or "" | |
return reduce(str.__add__,("L" , self , "R+" , "R" , other)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from archery import mdict, vdict | |
from math import pi, cos, sin, acos | |
class Matrix(mdict): | |
def __call__(self, other): | |
res= mdict() | |
for (src, dst), functor in self.items(): | |
res += mdict({ dst: functor(other[src])}) | |
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# -*- coding: utf-8 -*- | |
from sys import version | |
import platform | |
import locale | |
print("platfrom is %s" % platform.platform()) | |
print("default locale is "+repr( locale.getdefaultlocale())) | |
print("locale is "+repr( locale.getlocale())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Licence : Julien Tayon (2018) | |
If you find me a job in GIS or BigData I will change this license to a full | |
2 clauses BSD | |
Licence proprietaire sur un fichier a code source ouvert | |
ca me laissera le plaisir de poursuivre ceux qui le reutilisent sans mon accord | |
Proprietary licence with opened source. This a bait for all the newbies | |
that copy paste from the internet without taking attention of the licenses. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<header> | |
<script> | |
window.addEventListener("load", function(event) { | |
var color = %(color)s; | |
for( dep in color ) { | |
var el = document.getElementsByClassName("departement" + dep); | |
console.log(el); | |
el[0].style["fill"] = color[dep]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf8 -*- | |
import MySQLdb | |
from json import dumps | |
db = MySQLdb.connect(host="localhost", # your host, usually localhost | |
user="user", # your username | |
passwd="pass", # your password | |
db="edxapp") # name of the data base | |
TABLE_MAGANE='''SELECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## importing from notebook (hence ugly import) | |
from pyquery import PyQuery as S | |
doc = S("https://disic.github.io/rgaa_referentiel_3-2016/criteres.html") | |
interesting = doc("[id^=crit]") | |
import re | |
number = re.compile("crit-(?P<NUM>.*)$").search | |
dotted_num = re.compile("(?P<NUM>[\d\.]{1,5})").findall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyquery import PyQuery as S | |
import urllib | |
from json import loads, dumps | |
from os import path, makedirs | |
from requests import get | |
WAIT=.5 | |
""" | |
Admire the doc made by these fucking twats | |
http://www.bnf.fr/fr/professionnels/donnees_bnf_recuperables/a.donnees_rdf.html#SHDC__Attribute_BlocArticle7BnF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""disclaimer may trigger false negative/positive | |
no measuring tools are perfect | |
""" | |
from pyquery import PyQuery as P | |
doc= P("https://www.madewithangular.com/") | |
doc.make_links_absolute() | |
import re | |
def one_zero(itera): | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import pylab as P | |
import os | |
import readline | |
import atexit | |
from pyquery import PyQuery as S | |
import re | |
from json import load, dump, dumps |