Skip to content

Instantly share code, notes, and snippets.

View frietz58's full-sized avatar

Finn Rietz frietz58

View GitHub Profile
@frietz58
frietz58 / CellularAutomata.ipynb
Created July 17, 2022 18:15
Fun with Cellular Automata
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@frietz58
frietz58 / .bashrc
Last active May 11, 2022 09:04
Attach new interactive bash shell to runnig docker container
# to attach new bash sessions to docker container
# assumes that only one container is active, finds that containers id and attaches a new bash shell to it..
attach_new_sess () {
sudo docker ps;
containerid=$(sudo docker ps | tail -1 | awk '{print $1}');
echo "Extracted CONAINER ID: $containerid";
echo "Spawning new bash shell in container..."
sudo docker exec -it $containerid bash;
}
alias ans='attach_new_sess'
@frietz58
frietz58 / decorate-sort-undecorate.py
Last active December 10, 2019 22:08
Approximation of the Perl 'Decorate-Sort-Undecorate' idiom. Demonstrated on the the example of reordering the items in a matplotlib legend.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams.update({'font.size': 14})
# init figure
fig, ax = plt.subplots(1,1, figsize=(10,7))
# generate artificial data
line_a = np.linspace(100, 0, 85)