Skip to content

Instantly share code, notes, and snippets.

View Helveg's full-sized avatar

Robin De Schepper Helveg

View GitHub Profile
@Helveg
Helveg / blender-pizdaint.md
Created September 18, 2020 17:08
Building a headless Blender on PizDaint
  1. Download source & dependencies
# Make a folder
mkdir ~/blender-git
cd  ~/blender-git
# Clone the Blender repo
git clone https://git.blender.org/blender.git
# Clone the dependencies
mkdir ~/blender-git/lib
cd ~/blender-git/lib
@Helveg
Helveg / nrnpyenv_install.sh
Created March 20, 2021 06:57
NEURON pyenv install script
#!/bin/bash
# https://github.com/neuronsimulator/nrn/issues/409#issuecomment-576953060
#
# If first arg is "clean" then remove the neuron module
# from site-packages and exit.
#
# If first arg is "test" then run "python -c 'import neuron; neuron.test()'"
#
# If first arg is "install" then build and install with support for all
# subsequent pyenv version names.
import arbor, dbbs_models
from patch import p
# cell = arbor.cable_cell(morph.morphology, labels, decor)
model = dbbs_models.StellateCell
cell = model.cable_cell()
neuron_cell = model()
print(neuron_cell.soma)
neuron_cell.record_soma()
neuron_time = p.time
p.celsius = 32
@Helveg
Helveg / arbn_to_nrn.py
Last active November 8, 2021 16:07
Arbor morphology to NEURON object
class NrnCell:
def __init__(self):
self.all = []
def _dims(segments):
# Get the (prox - dist) ^ 2 along a certain axis
d = lambda seg, axis: (getattr(seg.prox, axis) - getattr(seg.dist, axis)) ** 2
# Sum and sqrt the distances along the x, y, z axes for eucl. dist
eucl = [sum(d(s, axis) for axis in ("x", "y", "z")) ** (1/2) for s in segments]
@Helveg
Helveg / ngDeepQuery.js
Created February 24, 2022 17:57
Deep and nested query parameters for Angular, for use with things like Strapi
class DeepQuery {
constructor(public query: any) {
}
private isObj(obj: any): boolean {
return (
typeof obj === 'object' &&
obj !== null
)
@Helveg
Helveg / binpack.md
Last active May 17, 2022 15:10
Binary compatibility in Python packaging

Binary compatibility in Python packaging

As a user of scientific computing software packages, Python packages always trips over binary extensions that require cooperation with binaries on the target system. Packaging things in wheels becomes impossible, because there is currently no way for a user to specify that they want a wheel, but specifically the wheel that is compatible with their local library.

Take mpi4py, the most popular parallelization scheme in my field. It requires to know which MPI implementation is used: MPICH, OpenMPI, ...? What mpi4py does is provide a source distribution that detects the local library at install time, and errors out if it can't. So the user is tasked with installing the binary dependencies of a Python package, before they can install the Python package. Python users have by design 0 knowledge of building binary software, we pip install or riot ┬─┬ノ(ಠ_ಠノ).