Skip to content

Instantly share code, notes, and snippets.

View szapp's full-sized avatar

Sören Zapp szapp

View GitHub Profile
@szapp
szapp / quickplot.py
Created December 10, 2019 15:13
Quick plotting functions
"""
Quick plotting for testing and preliminary data visualization
"""
from matplotlib import pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import numpy as np
__all__ = [
'imshow',
]
@szapp
szapp / smarterbounds.py
Last active December 10, 2019 15:12
Smarter bounds for matplotlib.spines.Spine
"""
Smarter bounds
This function emulates set_smart_bounds of matplotlib.spines.Spine,
but correctly sets the extent of the axes.
"""
def smarterbounds(ax, which='both'):
"""
@szapp
szapp / cell07.ipynb
Created December 4, 2018 14:01
Attempt to recreate figure 3 from Maheswaranathan et al, 2018
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@szapp
szapp / ejectUSB.sh
Last active October 11, 2019 08:49
Safely eject removable devices from command line (linux)
#!/bin/bash
# Equivalent to safely removing devices
# The parameter is (part of) the mountpoint
mountpoint=$1
if [[ -z "$mountpoint" ]] || [[ "$mountpoint" == "--help" ]] ; then
echo "Usage: ${0##*/} mountpoint"
exit 1
fi
@szapp
szapp / createreport.sh
Created July 9, 2018 15:30
Jupyter HTML template for "html_with_lenvs" for local viewing
#!/bin/bash
# Create report from juptyer notebook for local viewing (no internet)
# with support for the nbextensions
# - latex_envs
# - hide_input
#
# Download the following javascript projects and place them
# into the destination directory with macthing directory names.
# - font-awesome-4.7.0
# - jquery-2.0.3
@szapp
szapp / matlab_remove_trailing_whitespace
Last active September 22, 2016 09:22 — forked from hmaarrfk/matlab_remove_trailing_whitespace
Improved to replace the text only if it was changed to prevent the "unsaved" asterisk
% To remove a Matlab trailing whitespace in the editor
% Original Author: Sam Roberts
% http://stackoverflow.com/questions/19770347/how-to-auto-remove-trailing-whitespaces-on-save-in-matlab
% Modified by Mark Harfouche to remember cursor location
%
%
% Temp variable for shortcut. Give it an unusual name so it's unlikely to
% conflict with anything in the workspace.
shtcutwh__ = struct;