Skip to content

Instantly share code, notes, and snippets.

View gist:10283965
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:
if not identical_left_flag and identical_right_flag:
elif left[0] == right[0]:
return left, True
View gist:837c9d4b547892a177e1
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
c0ldlimit / gist:f6e04e764d6635942662
Created Jul 8, 2014
cron and virtualenv #python
View gist:f6e04e764d6635942662
/home/my/virtual/bin/python /home/my/project/ command arg
c0ldlimit / gist:61c7059534ea25af773b
Created Jul 8, 2014
virtualenv install without first installing pip
View gist:61c7059534ea25af773b
c0ldlimit / gist:892a6d65eef08a92fb4e
Created Jul 14, 2014
#sql select by max(date) - select the max entry date row
View gist:892a6d65eef08a92fb4e
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
# embedding some arbitrary rst file
.. include:: some_table.txt
# embedding arbitrary html from a file
.. raw:: html
# creating pdf with Sphinx and rst2pdf
c0ldlimit / gist:a3a89410eabf1e2bb169
Created Jul 17, 2014
#python installing exe in windows
View gist:a3a89410eabf1e2bb169
pip install wheel
wheel convert INSTALLER.EXE
View gist:f2e7f52d323bfce9bf6e
c0ldlimit / gist:bb9c080f2a09f69b47b6
Last active Aug 29, 2015
#matplotlib #python quick reference
View gist:bb9c080f2a09f69b47b6
# change fontsize
# change fontsize globally
# where to store matplotlibrc
# change figure size in ipython
c0ldlimit / gist:3c1731a2f49c78a55097
Last active Aug 29, 2015
#vagrant ubuntu with gui
View gist:3c1731a2f49c78a55097
# install virtualbox
# install vagrant
# full screen mode
sudo apt-get update
sudo apt-get install ubuntu-desktop^