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 / 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 / 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 / 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 / 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
@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: