Skip to content

Instantly share code, notes, and snippets.

Avatar

Fernando Perez fperez

View GitHub Profile
@fperez
fperez / gist:1483383
Created Dec 15, 2011
IPython impromptu PR
View gist:1483383
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 Dec 19, 2011
stuck kernel traceback
View gist:1495184
.[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 Dec 19, 2011
Animation notebook
View animation.ipynb
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 Jan 6, 2012
First draft of an ipython notebook html exporter for blogger
View nb2html.py
#!/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 / ipython-0.0.1.py
Created Jan 8, 2012
IPython 0.0.1, a simple script to be loaded as $PYTHONSTARTUP: of historical interest only...
View ipython-0.0.1.py
#!/usr/bin/env python
"""
Interactive execution with automatic history, tries to mimic Mathematica's
prompt system. This environment's main features are:
- Numbered prompts (In/Out) similar to Mathematica. Only actions that produce
output (NOT assingments, for example) affect the counter and cache.
- The following GLOBAL variables always exist (so don't overwrite them!):
_p: stores previous result which generated printable output.
@fperez
fperez / dsize
Created Mar 20, 2012
dsize: compute directory size information
View dsize
#!/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 Apr 9, 2012
async result .abort traceback
View gist:2347182
---------------------------------------------------------------------------
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 Apr 16, 2012
IPEP 1: Cleanup and extension of the Magic system in IPython
View magics.md

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 / .bash_utils
Created May 17, 2012
Bash configuration utilities for easy layered PYTHONPATH management
View .bash_utils
# -*- sh -*-
# Utilities for bash config files
# Contact: Fernando Perez <fernando.perez@colorado.edu>
#-----------------------------------------------------------------------------
# Useful constants
# For os, user or processor dependent config
@fperez
fperez / results.log
Created May 28, 2012
IPython test log
View results.log
..............................................
----------------------------------------------------------------------
Ran 46 tests in 0.054s
OK
..................................................................................................................................................................................................S............................S............................................................K.........
----------------------------------------------------------------------
Ran 294 tests in 15.570s
OK (KNOWNFAIL=1, SKIP=2)
You can’t perform that action at this time.