This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: https://twitter.com/Pen_Bird/status/1218965711780904960 | |
# it supports map['foo'] = 42, AND http://map.foo = 42, because its __dict__ is itself | |
class Map(dict): | |
def __init__(self, **kwargs): | |
super(Map, self).__init__(**kwargs) | |
self.__dict__ = self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python dependencies | |
sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev | |
# install curl if not already present | |
sudo apt instal curl | |
curl https://pyenv.run | bash | |
# add recommended lines to .bashrc and restart shell | |
echo '' >> ~/.bashrc | |
echo 'export PATH="/home/svrijn/.pyenv/bin:$PATH"' >> ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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"; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global alias.unstage 'reset HEAD --' | |
git config --global alias.lg 'log --oneline --graph --all' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |