View gist:10283965
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 merge_candidates(left, right, identical_left_flag, identical_right_flag): | |
candidates = [] | |
if identical_left_flag or identical_right_flag: | |
if identical_left_flag and not identical_right_flag: | |
candidates.append(left[0]) | |
if not identical_left_flag and identical_right_flag: | |
candidates.append(right[0]) | |
elif left[0] == right[0]: | |
return left, True |
View gist:837c9d4b547892a177e1
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/15864082/python-equivalent-of-matlabs-ismember-function | |
def ismember(a, b): | |
bind = {} | |
for i, elt in enumerate(b): | |
if elt not in bind: | |
bind[elt] = i | |
return [bind.get(itm, None) for itm in a] # None can be replaced by any other "not in b" value |
View gist:f6e04e764d6635942662
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/3287038/cron-and-virtualenv | |
/home/my/virtual/bin/python /home/my/project/manage.py command arg |
View gist:61c7059534ea25af773b
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/4324558/whats-the-proper-way-to-install-pip-virtualenv-and-distribute-for-python |
View gist:892a6d65eef08a92fb4e
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/7836036/how-to-select-by-maxdate | |
SELECT report_id, computer_id, date_entered | |
FROM reports AS a | |
WHERE date_entered = ( | |
SELECT MAX(date_entered) | |
FROM reports AS b | |
WHERE a.report_id = b.report_id | |
AND a.computer_id = b.computer_id | |
) |
View gist:6781549fc52a259f3c73
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
# embedding some arbitrary rst file | |
.. include:: some_table.txt | |
# embedding arbitrary html from a file | |
# http://docutils.sourceforge.net/docs/ref/rst/directives.html#include | |
.. raw:: html | |
# creating pdf with Sphinx and rst2pdf | |
# http://thyagjs.blogspot.com/2012/05/create-pdf-document-from-your-sphinx.html |
View gist:a3a89410eabf1e2bb169
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://www.lfd.uci.edu/~gohlke/pythonlibs/ | |
pip install wheel | |
wheel convert INSTALLER.EXE | |
pip install NEW_FILE_CREATED_IN_LAST_STEP.whl |
View gist:f2e7f52d323bfce9bf6e
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
sys.path.append(os.path.abspath('../triangle-project')) |
View gist:bb9c080f2a09f69b47b6
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
# change fontsize | |
http://stackoverflow.com/questions/12444716/how-do-i-set-figure-title-and-axes-labels-font-size-in-matplotlib | |
# change fontsize globally | |
http://stackoverflow.com/questions/3899980/how-to-change-the-font-size-on-a-matplotlib-plot | |
# where to store matplotlibrc | |
http://stackoverflow.com/questions/11535683/what-is-the-equivalent-to-home-in-a-virtualenv-python-specifically-for-matp | |
https://gist.github.com/huyng/816622 | |
# change figure size in ipython |
View gist:3c1731a2f49c78a55097
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
# install virtualbox | |
# install vagrant | |
# full screen mode | |
# http://askubuntu.com/questions/184794/win7-on-virtualbox-and-full-screen-mode/184804 | |
sudo apt-get update | |
sudo apt-get install ubuntu-desktop^ | |
OlderNewer