Skip to content

Instantly share code, notes, and snippets.

@mthh
mthh / mt.js
Created September 26, 2023 14:37
function makeTable(tab) {
const table = document.createElement('table');
table.style = 'border: none; border-collapse: collapse;';
const tbody = document.createElement('tbody');
Object.keys(tab[0])
.forEach((key) => {
const tr = document.createElement('tr');
const td1 = document.createElement('td');
const td2 = document.createElement('td');
td1.style = 'border-left: none; padding: 10px;';
@mthh
mthh / jenks.rs
Created January 17, 2017 23:18
Jenks "natural breaks" implementation in rust, for the fun
extern crate rustc_serialize;
extern crate time;
use time::PreciseTime;
use rustc_serialize::json;
use std::fs::File;
use std::io::Read;
use std::f64;
#[derive(RustcDecodable, RustcEncodable)]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import PyPDF2
import os
if __name__ == '__main__':
# Le chemin du dossier qui contient les pdf
path_input = '/home/mthh/Téléchargements/'
# Le chemin du dossier de sorties qui va acceuillir les fichiers docx
path_output = '/home/mthh/Téléchargements/output/'
from pdf2docx import parse
import os
if __name__ == '__main__':
# Le chemin du dossier qui contient les pdf
path_input = '/home/mthh/Téléchargements/'
# Le chemin du dossier de sorties qui va acceuillir les fichiers docx
path_output = '/home/mthh/Téléchargements/output/'
PARIS LILLE DIEPPE CHERBOURG-EN-COTENTIN ROUEN SAINT-BRIEUC REIMS NANCY BREST RENNES LE MANS CHAUMONT EPINAL TOURS QUIMPER VANNES DIJON BESANCON LA ROCHE-SUR-YON LA ROCHELLE CLERMONT-FERRAND LYON ALBERTVILLE GRENOBLE RODEZ BORDEAUX TOULOUSE HENDAYE FOIX PERPIGNAN MARSEILLE NICE
PARIS 0 250 240 535 160 630 180 395 825 450 240 255 575 350 970 765 345 510 490 530 525 530 895 815 880 545 850 1015 1170 1100 935 1410
@mthh
mthh / cholesky.rs
Last active September 5, 2022 21:46
Rust Cholesky decomposition
// Cholesky decomposition
// Translation of http://rosettacode.org/wiki/Cholesky_decomposition#C
// Posted on http://rosettacode.org/wiki/Cholesky_decomposition#Rust
//
// 'mat' is the positive-definite matrix 'A'
// 'res' is the product of a lower triangular matrix and its conjugate transpose (LL*)
// cf. https://en.wikipedia.org/wiki/Cholesky_decomposition
fn cholesky(mat: Vec<f64>, n: usize) -> Vec<f64> {
let mut res = vec![0.0; mat.len()];
for i in 0..n {
library(osmdata)
my_opq <- opq(bbox = bb) # Ou bb est la bbox souhaitée
# Tous les trucs "verts" (forêts, pelouses, parcs, vignes, etc.)
green1 <- my_opq %>%
add_osm_feature(key = "landuse", value = c("allotments",
"farmland","cemetery",
"forest", "grass", "greenfield",
"meadow",
@mthh
mthh / .block
Last active December 4, 2020 18:17
Canvas native API / Pixi canvas renderer
license: gpl-3.0
border: no
[5.005121249705553,6.7698845686391,1.021586733404547,9.385886443778872,4.548310353420675,6.354603075888008,8.976253494620323,5.191713236272335,4.7715608100406826,7.863712448161095,6.641501183621585,6.910042501986027,3.1715067266486585,0.873259964864701,4.488653743173927,8.203441253863275,9.454990027006716,4.74380933213979,2.5307508395053446,1.0617040214128792,5.692806332372129,9.596363012678921,8.741002352908254,7.56973524345085,9.692003140226007,4.701106182765216,0.25467247469350696,4.183835571166128,8.283707208465785,0.4071679199114442,0.8745960821397603,1.1438903491944075,8.09175917180255,7.531579013448209,3.8455851934850216,6.937670034822077,9.154734222684056,8.531235912814736,0.5893597682006657,2.1916877175681293,8.572350428439677,5.654468149878085,4.872281996067613,7.774307862855494,3.458382107783109,0.21459681214764714,5.651148806791753,8.170698226895183,3.793332518544048,3.538043680600822,5.262194804381579,4.906901775393635,7.565307286567986,0.5521937622688711,3.6833292455412447,3.1848908960819244,3.2