- Header and a Brief description (should match package.json)
- Example (if applicable)
- Motivation (if applicable)
- API Documentation: This will likely vary considerably from library to library.
- Installation
- Tests
- Contributors
- License
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 sys | |
from gprof2dot import gprof2dot | |
import pygraphviz as pgv | |
import os.path | |
PRUNE = True | |
DEFAULT_NODE_TRESHOLD = 0.5 | |
DEFAULT_EDGE_TRESHOLD = 0.1 | |
if __name__ == '__main__': |
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
%% FANCY PLOTTING %% | |
% Code by Mathias Tausen, 2011 % | |
% Contact: mathias.tausen@gmail.com % | |
% Version: beta 0.5 rev1, 191211 % | |
%----------------------------------------------------------% | |
% Eases the process of plotting data with MATLAB % | |
% % | |
% How to use: % | |
% - Specify the data files in the files cell, syntax: % | |
% files = {'file1';'file2';'file3'}; % |
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
python -m cProfile -o rep.prof <script.py> | |
python -c 'import pstats; p=pstats.Stats('rep.prof'); p.sort_stats('cumulative').print stats(10)' |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
A lot of math grad school is reading books and papers and trying to understand what's going on. The difficulty is that reading math is not like reading a mystery thriller, and it's not even like reading a history book or a New York Times article.
The main issue is that, by the time you get to the frontiers of math, the words to describe the concepts don't really exist yet. Communicating these ideas is a bit like trying to explain a vacuum cleaner to someone who has never seen one, except you're only allowed to use words that are four letters long or shorter.
What can you say?
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
if __name__ == "__main__": | |
import sys | |
import pstats | |
stats = pstats.Stats(sys.argv[1]) | |
stats.strip_dirs() | |
stats.sort_stats('cumulative') | |
stats.print_stats() |
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
""" | |
Usage: python remove_output.py notebook.ipynb [ > without_output.ipynb ] | |
Modified from remove_output by Minrk | |
""" | |
import sys | |
import io | |
import os | |
from IPython.nbformat.current import read, write |
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
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
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
# http://stackoverflow.com/questions/963965/how-is-this-strategy-pattern | |
# -written-in-python-the-sample-in-wikipedia | |
""" | |
In most of other languages Strategy pattern is implemented via creating some | |
base strategy interface/abstract class and subclassing it with a number of | |
concrete strategies (as we can see at | |
http://en.wikipedia.org/wiki/Strategy_pattern), however Python supports | |
higher-order functions and allows us to have only one class and inject | |
functions into it's instances, as shown in this example. | |
""" |
OlderNewer