Skip to content

Instantly share code, notes, and snippets.

@uschille
uschille / extract_code.py
Last active April 14, 2023 00:29 — forked from bobturneruk/extract_code.py
pulls code out of carpentries episodes - not the most reliable!
import sys
import os
import re
path = os.path.dirname(sys.argv[1])
path = "." if path == "" else path
episode = os.path.splitext(os.path.basename(sys.argv[1]))[0]
with open(f"{path}/{episode}.md") as f:
content = f.read()
@uschille
uschille / check_code.sh
Created April 13, 2023 22:21
Shell script for extracting and checking code in Carpentries episodes
#!/bin/sh
# uses @bobturneruk's extract_code.py: https://gist.github.com/bobturneruk/dfccd3d6ce5af7545c4a1159ce4724e8
for file in $(ls _episodes/*.md); do
echo "Checking Python code in ${file}"
python extract_code.py $file > /dev/null
python _episodes/$(basename -s .md $file).py > /dev/null
rm _episodes/$(basename -s .md $file).py
done
@uschille
uschille / lb-walking.c
Last active February 5, 2024 21:12
A simple efficient 3D lattice Boltzmann code employing the collide-stream-collide scheme.
/***********************************************************************
*
* lb-walking.c
*
* Copyright (c) 2009-2014 Ulf D. Schiller <ulf@lattice-boltzmann.de>
* All rights reserved.
*
* Please cite the following publications when using this code:
*
* U. D. Schiller