Skip to content

Instantly share code, notes, and snippets.

Cyrille Rossant rossant

Block or report user

Report or block rossant

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rossant
rossant / onelight.py
Last active Sep 24, 2019
ONE light API proposal
View onelight.py
from onelib import one
"""
Different ONE backends are available, HTTP, figshare, etc.
One has to implement the following functions to create a new ONE backend:
* list_all_files(): return a list of relative file paths for ALL available files.
* search(...): return a list of dset_ids (by default, a dset_id is a relative file path).
The default implementation calls list_all_files(), and performs the search directly on that list.
@rossant
rossant / parallel_write.py
Created Aug 30, 2019
Write a NumPy array in parallel from multiple CPUs/processes, using shared memory. No copy/serialization involved. Pure Python/NumPy.
View parallel_write.py
"""Write a NumPy array in parallel from multiple CPUs/processes, using shared memory."""
from contextlib import closing
import multiprocessing as mp
import os
import numpy as np
def _init(shared_arr_):
View ftv.py
import os
import requests
import shutil
def _dl(url, path):
print("download", url, "to", path)
response = requests.get(url, stream=True)
if response.status_code != 200:
return
@rossant
rossant / glwidget.py
Created Nov 26, 2018
Minimal modern PyQt5, OpenGL, QOpenGLWindow working example
View glwidget.py
#!/usr/bin/env python3
"""
Code from http://www.labri.fr/perso/nrougier/python-opengl/#the-hard-way
"""
import ctypes
import logging
@rossant
rossant / latex_to_image.py
Created Feb 12, 2018
Convert a LaTeX equation into EPS and PNG with Python
View latex_to_image.py
import os
import os.path as op
from pathlib import Path
import shutil
import subprocess
import tempfile
from IPython.lib.latextools import genelatex
@rossant
rossant / code_postal.vba
Last active Dec 2, 2016
VBA code to find French cities associated to a given postal code
View code_postal.vba
Function collectionToArray(c As Collection) As Variant()
Dim a() As Variant: ReDim a(0 To c.Count - 1)
Dim i As Integer
For i = 1 To c.Count
a(i - 1) = c.Item(i)
Next
collectionToArray = a
End Function
@rossant
rossant / latest_pandoc.sh
Created Mar 28, 2016
Install latest .deb pandoc, using the GitHub release page -- useful on CI systems
View latest_pandoc.sh
URL="https://github.com/jgm/pandoc/releases/latest"
PANDOCPAGE="$(wget $URL -q -O -)"
DEBURL="$(echo $PANDOCPAGE | grep -oP '"([^"]+.deb)"')"
DEBURL="${DEBURL:1:-1}"
URL="http://github.com/$DEBURL"
wget $URL -O pandoc.deb
sudo dpkg -i pandoc.deb
@rossant
rossant / installer.md
Last active Mar 26, 2016
Build cross-plaform graphical installers for Python software
View installer.md

Distributing Python software to non-technical users is too hard. We need to make it simpler.

I'm imagining a tool based on conda.

Ideally I'd like to have something like this:

  • I write an environment.yml file with the conda/pip dependencies for my software
  • I write an installer.yml file that describes my installer: package name, paths to logo/images, icon shortcuts for binaries, etc.
  • I type build-installer and a few files are created:
    • mypackage.sh: for Unix systems
We couldn’t find that file to show.
@rossant
rossant / _template.ott
Last active Mar 15, 2018
Convert from Markdown to OpenOffice for Linux Magazine
You can’t perform that action at this time.