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
# This is a test gist, just to see how this works. | |
a=3 | |
for i in range(10): | |
x=3 | |
print(x) |
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
<html> | |
<head> | |
<title>test</title> | |
</head> | |
<body> | |
<h1>testing gist again</h1> | |
<script src="http://gist.github.com/3806.js"></script> | |
</body> | |
</html> |
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
# Load a sparse matrix. | |
import numpy as np | |
from scipy import sparse | |
def mymethod(): | |
print 'hi' | |
def load_sparse(filename, dtype=np.float32): | |
with file(filename) as input: |
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
This is gist. | |
There are many like it, but this one is mine. | |
It is my life. | |
I must master it as I must master my life. | |
Without me gist is useless. | |
Without gist, I am useless. |
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
import contextlib | |
@contextlib.contextmanager | |
def timing(results=None): | |
""" | |
Time the execution of the block of code. If a results list is | |
passed in, the time is appended to the list. Also returns a list | |
of one element containing the time the execution took. | |
To use, do something like: |
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 mydecorator(object): | |
def __init__(self, times, repeats): | |
self.times=times | |
self.repeats=repeats | |
self.a=1 | |
def __call__(self, func): | |
# here, we just need to return a new function. That new function will be what is actually stored in the name and run when I. | |
def myfunc(*args, **kwargs): | |
# *this* inner function is what is actually called |
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 fsum(x,a): | |
g(x) = 1/2 | |
list_of_terms=[2*(((-1)^n-1)/(n*pi)^2*cos(n*pi*x)-(-1)^n/(n*pi)*sin(n*pi*x)) for n in [1..a]] | |
g += sum(list_of_terms) | |
return g |
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
print 'hi' |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Simple Compute Server</title> | |
<script type="text/javascript" src="http://sagemath.org:5467/static/jquery-1.5.min.js"></script> | |
<script type="text/javascript" src="http://sagemath.org:5467/embedded_singlecell.js"></script> | |
<script> |
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
TEXT(<<'EOF'); | |
<div id="singlecell-test"><script type="text/code">var('x') | |
x0 = 0 | |
f(x) = sin(x)*e^(-x) | |
p = plot(f,(x,-1,5), thickness=2) | |
dot = point((x0,f(x=x0)),pointsize=80,rgbcolor=(1,0,0)) | |
@interact | |
def _(order=(1..12)): | |
ft = f.taylor(x,x0,order) | |
pt = plot(ft,(x,-1, 5), color='green', thickness=2) |
OlderNewer