This file contains hidden or 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 | |
""" | |
Self-launching MPI4PY script that uses spawning and sets an environmental | |
variable to different values for each of the launched script instances.. | |
Notes | |
----- | |
Requires an MPI implementation that supports dynamic process management. | |
""" |
This file contains hidden or 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
#!/bin/bash | |
# Script for continuously previewing graphviz dot files using dot2tex. | |
# Copyright (c) 2015, Lev Givon | |
# All rights reserved | |
# Distributed under the terms of the BSD license: | |
# http://www.opensource.org/licenses/bsd-license | |
SCRIPT_NAME=`basename $0` |
This file contains hidden or 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 | |
""" | |
Retrieve intraday stock data from Google Finance. | |
""" | |
import csv | |
import datetime | |
import re | |
import pandas as pd |
This file contains hidden or 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 | |
""" | |
Group of queues; data can be pushed/popped into each queue separately, but one | |
can also pop off values from all of the queues simultaneously. | |
+-------+ | |
queue a: in -> | |A|B| | |
+-------+ out -> (B,C) | |
queue b: in -> | |C| |
This file contains hidden or 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/bin python | |
""" | |
How to use twiggy for logging in both parent and MPI-spawned processes. | |
""" | |
import sys | |
# Need to use dill to serialize the twiggy emitters because pickle can't handle | |
# them: |
This file contains hidden or 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 | |
""" | |
How to find globals accessed by a Python object. | |
""" | |
import inspect | |
import numpy as np |
This file contains hidden or 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 | |
""" | |
How to create a class with an attribute that provides its own __getitem__() | |
method (similar to pandas.DataFrame.ix). | |
""" | |
class Indexer(object): | |
def __init__(self, data): | |
if not hasattr(data, '__getitem__') or not hasattr(data, '__setitem__'): |
This file contains hidden or 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 | |
""" | |
Morris-Lecar neurons connected by a conductance-based synapse. | |
""" | |
import numpy as np | |
import matplotlib | |
matplotlib.use('agg') |
This file contains hidden or 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 | |
""" | |
Morris-Lecar neuron model implemented using Brian. | |
""" | |
import numpy as np | |
import matplotlib | |
matplotlib.use('agg') |
This file contains hidden or 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
# Put this in your IPython profile configuration, e.g., ~/.ipython/profile_default/ipython_config.py | |
import os | |
extra = '' | |
if os.environ.has_key('VIRTUAL_ENV'): | |
v = os.path.basename(os.environ['VIRTUAL_ENV']) | |
extra += '<%s> ' % v | |
if os.environ.has_key('CONDA_DEFAULT_ENV'): | |
extra += '[%s] ' % os.environ['CONDA_DEFAULT_ENV'] |