Skip to content

Instantly share code, notes, and snippets.

View sjvrijn's full-sized avatar

Sander van Rijn sjvrijn

View GitHub Profile
@sjvrijn
sjvrijn / plot_cluster_counts.py
Created December 4, 2025 09:05
A script to illustrate the correlation between which experiment produced a spore, and which cluster they ended up in
# coding: utf-8
# Author: Sander van Rijn <s.vanrijn@esciencecenter.nl>
# Date: 2025-12-04 10:03
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
@sjvrijn
sjvrijn / .zshrc
Last active May 20, 2024 23:03
pyenv display oh-my-zsh
# User configuration
export PATH="$HOME/.pyenv/bin/:$HOME/.pyenv/shims/:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
# Theme customisation
prompt_virtualenv() { # show pyenv version-name if not using 'system'
local version="$(pyenv version-name)"
if [[ $version != "system" ]]; then
@sjvrijn
sjvrijn / .gitconfig
Last active November 16, 2026 13:55
git aliases
[alias]
fush = push --force-with-lease
lg = log --oneline --graph --all
siff = diff --staged
wiff = diff --word-diff
swiff = diff --staged --word-diff
rpo = remote prune origin
@sjvrijn
sjvrijn / .bash_aliases
Created January 22, 2021 14:12
Launch a jupyter lab instance on a remote machine while accessing locally with 'remotenotebook jupyter-remote':
# Add this function in your ~/.bash_aliases file, which takes the desired remote machine as argument:
remotenotebook() { ssh -4 -L 8891:localhost:8891 $1 -t "~/.ipynb"; }
git remote add SECOND [SECOND_URL]
git push SECOND master
git remote add BOTH [ORIG_URL]
git remote set-url --push BOTH [ORIG_URL]
git remote set-url --push --add BOTH [SECOND_URL]
git push BOTH
@sjvrijn
sjvrijn / invert.sh
Created December 11, 2019 14:42
invert directory hierarchy: A/B/* -> B/A/*
#!/bin/bash
for a in */; do
for b in $a/*/; do
dir=${b##*//}
mkdir -p $dir$a
mv $a$dir* $dir$a
done
rm -rf $a
done
@sjvrijn
sjvrijn / recreate.py
Created November 4, 2019 13:23
recreation of a drawing I saw somewhere
# coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
def recreate(n=8000, s=5, scale=1.45, ymax=.68):
norm = Normalize(vmin=0, vmax=1, clip=True)
origin = np.array([.5, 0])