Playing around to see what one can do using Gist pages for writing.
This file has been truncated, but you can view the full file.
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
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:a04c38d9604adb7eb9ca89860dfa1ef72db66037cc2c07c391ef8e67a31f9254" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
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 parse_orgtable(s): | |
"""Parse an org-table (input as a multiline string) into a Pandas data frame.""" | |
# This didn't quite work, because spaces messed things up | |
#import cStringIO | |
#table = pd.read_table(cStringIO.StringIO(s),sep='|',skiprows=[1],skipinitialspace=True) | |
#table = table.drop(table.columns[[0,-1]],1) | |
# I suppose I could have simply run strip() on all of the resulting column names, since that was the problem | |
def parseline(l): | |
w = l.split('|')[1:-1] | |
return [wi.strip() for wi in w] |
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
{ | |
"metadata": { | |
"name": "Sympy Circuit Plot" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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
#!/usr/bin/env python | |
""" | |
CellularAutomata.py: Wolfram-style cellular automata in Python | |
Options: | |
-h # Use a screen of height # for the simulation | |
-w # Use a screen of width # for the simulation | |
-r Use a random initial row (rather than the standard single 1 in the middle) | |
-R # Use rule # for the simulation |
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
#!/usr/bin/env python | |
"""\ | |
Polynomial.py - A set of utilities to manipulate polynomials. This consists | |
of a set of simple functions to convert polynomials to a Python list, and | |
manipulate the resulting lists for multiplication, addition, and | |
power functions. There is also a class that wraps these functions | |
to make their use a little more natural. | |
This can also evaluate the polynomials at a value, and take integrals | |
and derivatives of the polynomials. |
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
class FileCacher: | |
"Cache the stdout text so we can analyze it before returning it" | |
def __init__(self): self.reset() | |
def reset(self): self.out = [] | |
def write(self,line): self.out.append(line) | |
def flush(self): | |
output = '\n'.join(self.out) | |
self.reset() | |
return output |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder