Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def _make_fancy(*args, **kwds): | |
return (fancyIndexingDict(*args, **kwds) | |
if len(kwds) or (len(args) and hasattr(args[0], 'keys')) else | |
fancyIndexingList(*args, **kwds)) | |
def _fancy_getitem(fancy_x, index): | |
index = index if hasattr(index, '__iter__') else (index, ) | |
index = index if type(index) is tuple else tuple(index) | |
if isinstance(fancy_x, fancyIndexingDict): |
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
# Command to run in TTY (Ctrl-Alt-F5 or similar) | |
# Found this little gem on https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1181666 | |
dbus-send --type=method_call --print-reply --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'global.reexec_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
# I miss the simplicity of launching a fresh shell when using Jupyter | |
# This is my wonderfully weird way of fixing that (at least on Linux) | |
# Config and desktop integration: | |
jupyter notebook --generate-config | |
echo " | |
import os | |
from subprocess import check_call |
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
def genericSlice(length,start=None,stop=None,step=None,includeStop=False,oneBased=False,checkBounds=False): | |
'''A generic version of "slice" supporting: | |
* dropping or keeping the stop value | |
* 0-based and 1-based indexing | |
* optional bounds checking | |
* +/-/None indexes (as usual) | |
Requires the length of the list that will be sliced. | |
Returns a slice object. |