Skip to content

Instantly share code, notes, and snippets.

View fperez's full-sized avatar

Fernando Perez fperez

View GitHub Profile
@fperez
fperez / gist:1483383
Created December 15, 2011 23:00
IPython impromptu PR
diff --git a/IPython/core/magic.py b/IPython/core/magic.py
index ee84680..f82b43f 100644
--- a/IPython/core/magic.py
+++ b/IPython/core/magic.py
@@ -2151,7 +2151,10 @@ Currently the magic system has the following functions:\n"""
%loadpy http://www.example.com/myscript.py
"""
arg_s = unquote_filename(arg_s)
- if not arg_s.endswith('.py'):
+ if not arg_s.startswith('http') and not arg_s.endswith('.py'):
@fperez
fperez / gist:1495184
Created December 19, 2011 02:48
stuck kernel traceback
.[NotebookApp] Kernel restarted: 0a11e240-cfca-470a-bd0b-7dce9e98fe42
[NotebookApp] Connecting to: tcp://127.0.0.1:50307
[NotebookApp] Connecting to: tcp://127.0.0.1:53988
[NotebookApp] Connecting to: tcp://127.0.0.1:58216
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (351, 0))
---------------------------------------------------------------------------
ZMQError Traceback (most recent call last)
/home/fperez/tmp/src/scipy/<string> in <module>()
@fperez
fperez / animation.ipynb
Created December 19, 2011 03:48
Animation notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fperez
fperez / nb2html.py
Created January 6, 2012 07:53
First draft of an ipython notebook html exporter for blogger
#!/usr/bin/env python
"""A really simple notebook to rst/html exporter.
Usage
./nb2html.py file.ipynb
Produces 'file.rst' and 'file.html', along with auto-generated figure files
called nb_figure_NN.png.
@fperez
fperez / dsize
Created March 20, 2012 22:12
dsize: compute directory size information
#!/bin/sh
# Script to summarize the sizes of files and subdirs in a given directory.
# If no arguments are given, the current directory is used.
# Modified after: http://www.newartisans.com/johnw/scripts/sizes
dir=${1:-.}
@fperez
fperez / gist:2347182
Created April 9, 2012 22:52
async result .abort traceback
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/sgeadmin/<ipython-input-45-75c2b5e59cd8> in <module>()
----> 1 amr.abort()
/software/python-2.7.1-release/lib/python2.7/site-packages/IPython/parallel/client/asyncresult.pyc in abort(self)
196 """abort my tasks."""
197 assert not self.ready(), "Can't abort, I am already done!"
--> 198 return self.client.abort(self.msg_ids, targets=self._targets, block=True)
199
@fperez
fperez / magics.md
Created April 16, 2012 04:28
IPEP 1: Cleanup and extension of the Magic system in IPython

IPEP 1: Cleanup and extension of the Magic system in IPython

This document reviews the status of the magic command system in IPython and proposes an extension of magics to work in multiline contexts, at a 'cell' level. The most obvious use of this proposed extension will be the notebook, but the extension will similarly work in the Qt console and even at the terminal.

In the spirit of Python PEPs, this document is marked as IPEP 1, the first 'IPython Enhancement Proposal'.

@fperez
fperez / results.log
Created May 28, 2012 06:56
IPython test log
..............................................
----------------------------------------------------------------------
Ran 46 tests in 0.054s
OK
..................................................................................................................................................................................................S............................S............................................................K.........
----------------------------------------------------------------------
Ran 294 tests in 15.570s
OK (KNOWNFAIL=1, SKIP=2)
@fperez
fperez / results.log
Created May 28, 2012 07:12
IPython test log
..............................................
----------------------------------------------------------------------
Ran 46 tests in 0.047s
OK
........................................................................................................................................................................................................................................................................................................................................................................................................................K.........
----------------------------------------------------------------------
Ran 423 tests in 17.377s
OK (KNOWNFAIL=1)
@fperez
fperez / results.log
Created May 28, 2012 07:12
IPython test log
..............................................
----------------------------------------------------------------------
Ran 46 tests in 0.054s
OK
..................................................................................................................................................................................................S.............................S............................................................K.........
----------------------------------------------------------------------
Ran 295 tests in 15.026s
OK (KNOWNFAIL=1, SKIP=2)