Skip to content

Instantly share code, notes, and snippets.

View cerisara's full-sized avatar

Christophe Cerisara cerisara

  • LORIA - CNRS
  • Nancy, France
View GitHub Profile
@cerisara
cerisara / pure_torch.py
Created February 16, 2024 12:26 — forked from Narsil/pure_torch.py
Loading a safetensors file with pure torch only
import mmap
import torch
import json
import os
from huggingface_hub import hf_hub_download
def load_file(filename, device):
with open(filename, mode="r", encoding="utf8") as file_obj:
with mmap.mmap(file_obj.fileno(), length=0, access=mmap.ACCESS_READ) as m:
@cerisara
cerisara / gist:90259aa9eb35f63c9a9910c8feb71b6c
Created April 3, 2022 14:19
calcuse on android with termux-gui and git
import termuxgui as tg
import sys
import time
import threading
import os
import datetime
import calendar
with tg.Connection() as c:
@cerisara
cerisara / centres_dept.txt
Created March 21, 2020 10:40
afficher carte des malades du COVID par département
01 46°05’58" 5°20’56" E AIN
02 49°33’34" 3°33’30" E AISNE
03 46°23’37" 3°11’18" E ALLIER
04 44°06’22" 6°14’38" E ALPES-DE-HAUTEPROVENCE
05 44°39’49" 6°15’47" E HAUTES-ALPES
06 43°56’15" 7°06’59" E ALPES-MARITIMES
07 44°45’06" 4°25’29" E ARDECHE
08 49°36’56" 4°38’27" E ARDENNES
09 42°55’15" 1°30’14" E ARIEGE
10 48°18’16" 4°09’42" E AUBE
@cerisara
cerisara / Plot histogram with gnuplot
Created January 21, 2020 08:28
Easy-to-use script to plot histograms from a text file with gnuplot
#!/bin/bash
d=0.5
if [ $# -ge 2 ]; then
echo "2parms $1 $2"
d=$2
fi
rm -f /tmp/pp.gp
touch /tmp/pp.gp
@cerisara
cerisara / DeptsFin2vie.txt
Last active December 16, 2019 20:04
Départements les plus accueillants en fin de vie
En ne comptant que les personnes décédées dans un autre département que leur département de naissance,
voici les départements (à droite) ayant accueillis le plus de personnes jusqu'à la fin de leur vie:
On retrouve, comme on pouvait s'y attendre, la région Parisienne et la côté d'azur qui accueillent le plus
de personnes jusqu'à la fin de leur vie.
Et dans l'autre sens, c'est la Lozère qui accueille le moins de monde en fin de vie !
(Ou alors, il y a un biais dans les données...)
6 96
1991 98
@cerisara
cerisara / courbe.md
Last active December 16, 2019 20:01
durée de vie moyenne des personnes décédées par date de naissance en France
@cerisara
cerisara / Arxiv2Kindle.sh
Last active October 25, 2016 19:28
Arxiv2Kindle
#!/bin/bash
# arxiv paper ID
python2 getarxivid.py $1 > arxivids
mkdir papers
for i in $(cat arxivids)
do
@cerisara
cerisara / tex2md.py
Created October 23, 2016 19:40
Fast convert latex to markdown (part of Arxiv2Kindle)
import sys
def getText(l):
l=l.replace('\\citep','')
l=l.replace('\\cite','')
return l
with open(sys.argv[1],'rb') as f : ls = f.readlines()
empty=False
Data Parallelization with multi-GPU over TensorFlow
Jonathan Laserson <jonilaserson@gmail.com>
9 oct. (Il y a 2 jours)
À Keras-users Se désabonner
Here is how to take an existing model and do data parallelization across multiple GPUs.
@cerisara
cerisara / gitolab.php
Created August 31, 2016 09:13 — forked from benoitzohar/gitolab.php
Migrate repositories from Gitolite to GitLab.
#!/usr/bin/php -qC
<?php
/******************************************************************************
*
* @file gitolab.php
* @author Benoit Zohar
* @link http://benoitzohar.fr/
* @last-edited 2015-01-09
* @description Migrate projects from Gitolite to GitLab