Skip to content

Instantly share code, notes, and snippets.

Thomas Kluyver takluyver

Block or report user

Report or block takluyver

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View attr_completion.py
class CompleteAttrs(object):
def __getattr__(self, name):
if name == 'foo':
return 1
if name == 'bar':
return 2
raise AttributeError(name)
def __dir__(self):
return ['foo', 'bar'] + object.__dir__(self)
View .inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[1;5D": backward-word
"\e[1;5C": forward-word
# I don't need pings as I tab complete things
set bell-style none
@takluyver
takluyver / mods.json
Last active Oct 19, 2017
Unrecognised stdlib modules
View mods.json
{
"notfiles": [
"_ast",
"_codecs",
"_collections",
"_functools",
"_imp",
"_io",
"_locale",
"_operator",
@takluyver
takluyver / qtconsole_interrupt.ipynb
Created Oct 10, 2017
Qtconsole crashing on interrupt
View qtconsole_interrupt.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:2682c5333e10934218c7e6baa04f2eda
======================================================================
ERROR: test_multiple_levels (game.tests.test_scoreboard.ScoreboardCsvTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/takluyver/Code/rapid-router/game/tests/test_scoreboard.py", line 203, in test_multiple_levels
actual_header, actual_rows = self.actual_data(response.content)
File "/home/takluyver/Code/rapid-router/game/tests/test_scoreboard.py", line 270, in actual_data
split = content.split("\r\n")
TypeError: a bytes-like object is required, not 'str'
@takluyver
takluyver / gist:edcfd25c64875a947158b19b2bbb21cb
Created Jul 16, 2017
Traceback from codeforlife-portal
View gist:edcfd25c64875a947158b19b2bbb21cb
ERROR:root:Exception occurred while handling GET request to /portal/admin/map/
Traceback (most recent call last):
File "/home/takluyver/miniconda3/envs/rr-py3/lib/python3.6/site-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/takluyver/miniconda3/envs/rr-py3/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/home/takluyver/miniconda3/envs/rr-py3/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
if test_func(request.user):
File "/home/takluyver/miniconda3/envs/rr-py3/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 71, in check_perms
raise PermissionDenied
View nbviewer.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@takluyver
takluyver / myexporter.py
Last active Jun 1, 2017
Pass extra variables to nbconvert template
View myexporter.py
# Pass an extra variable to an nbconvert template
# Untested
from nbconvert.exporters import HTMLExporter
class MyExporter(HTMLExporter):
def from_notebook_node(self, nb, resources=None, my_var=None, **kw):
self.environment.globals['my_var'] = my_var
return super().from_notebook_node(nb, resources=resources, **kw)
View gist:08fb5894286470c5b156f3f5835eb1fd
$ make test
./setup.py test
running pytest
Searching for typing<3.6,>=3.5.2
Best match: typing 3.5.3.0
Processing typing-3.5.3.0-py2.7.egg
Using /home/takluyver/Code/cwltool/.eggs/typing-3.5.3.0-py2.7.egg
Searching for schema-salad<3,>=2.4.20170308171942
Best match: schema-salad 2.5.20170428142041
@takluyver
takluyver / Equation tables.ipynb
Created Feb 27, 2017
Test Jupyter mathjax in tables issue
View Equation tables.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.