Skip to content

Instantly share code, notes, and snippets.

View cvanelteren's full-sized avatar

Casper van Elteren cvanelteren

View GitHub Profile
@cvanelteren
cvanelteren / annotation_network.py
Created May 29, 2024 09:45
cross_figure annotation
import proplot as plt, cmasher as cmr, pandas as pd,\
numpy as np, os, sys, networkx as nx, warnings,\
re
from pathlib import Path
warnings.simplefilter("ignore")
g = nx.krackhardt_kite_graph()
pos = nx.kamada_kawai_layout(g)
@cvanelteren
cvanelteren / networkx_with_image.py
Created June 1, 2024 10:52
replace networkx nodes with images
import matplotlib.pyplot as plt
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
g = nx.krackhardt_kite_graph()
pos = nx.kamada_kawai_layout(g)
example = "unknown.jpg"
fig, ax = plt.subplots()
output_size = 25
#!/usr/bin/env bashgit clone --bare [email protected]:cvanelteren/dots.git $HOME/.dotfiles# define config alias locally since the dotfiles
# aren't installed on the system yet
function config {
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}# create a directory to backup existing dotfiles to
mkdir -p .dotfiles-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out dotfiles from [email protected]:cvanelteren/dotfiles.git";
else
@cvanelteren
cvanelteren / vibrant.py
Created August 10, 2024 16:08
vibrant colormap
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import numpy as np
def create_continuous_colormap(colors, name='custom_colormap'):
# Define color positions (evenly spaced between 0 and 1)
n = len(colors)
positions = np.linspace(0, 1, n)
# Create a colormap
@cvanelteren
cvanelteren / gil_test.nim
Created August 29, 2024 07:57
Releasing the GIL in Nim
import strutils, strformat, os, random, times
import dynlib
import nimpy, nimpy/py_lib, nimpy/py_types
{.pragma: pyfunc, cdecl, gcsafe.}
import locks
import malebolgia, math
import random, os
import chronos
@cvanelteren
cvanelteren / matplotlib_animation.ipynb
Last active May 13, 2025 07:32
Exercise EHCO group
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.