View patch-bash.sh
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
#!/bin/sh | |
# Manually patch and compile bash for systems like FC16 that don't have shellshock protection | |
# availalbe through their package managers. | |
# sudo yum install patch byacc texinfo bison autoconf gettext ncurses-devel | |
VERSION1=4 | |
VERSION2=2 | |
VERSION_PATCH=52 |
View install-sublime-text-x64.sh
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
#!/bin/sh | |
SHORTCUT="[Desktop Entry] | |
Name=Sublime Text 2 | |
Comment=Edit text files | |
Exec=/usr/local/sublime-text-2/sublime_text | |
Icon=/usr/local/sublime-text-2/Icon/128x128/sublime_text.png | |
Terminal=false | |
Type=Application | |
Encoding=UTF-8 | |
Categories=Utility;TextEditor;" |
View tree_walking.py
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 walk_level(path, level=1): | |
"""Like os.walk, but takes `level` kwarg that indicates how deep the recursion will go. | |
Notes: | |
TODO: refactor `level`->`depth` | |
References: | |
http://stackoverflow.com/a/234329/623735 | |
Args: |
View gamblers_falacy.py
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
"""Attempt to confirm results in paper by Miller and Sanjurjo | |
["Confused by the Gambler's and Hot Hand Falacy?..."](http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2627354) | |
Calculate the probability of a streak of length 2 in a coin flip | |
for a small sequence of attempts ("finite sequence of iid Bernoulli trials"). | |
The fencepost counting issue means you have to ignore one of the flips. | |
Perhaps this is what causes Miller and Sanjurjo to get 0.4 instead of 0.5. | |
"the conditional relative frequency... is 0.4 not 0.5" | |
""" | |
from random import randint |
View BYOB-Learn-to-be-Logical.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View generating-the-semi-in-positive-semidefinite-stack-overflow-619335.py
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
r"""Faulty positive semidefinite matrix generator | |
Using a normally distributed random matrix it's pretty | |
rare that you'll get a semidefinite matrix from the product, | |
even for low dimensions. For 3 dimensions you have about a 0.001%% yield | |
>>> pos_semi_matrices = generate_positive_semidefinite_matrices(num_samples=1000) | |
6.7% were positive semidefinite and not positive definite | |
45.5% were positive definite | |
52.2% were positive semidefinite |
View install_django_with_wsgi_on_dreamhost.sh
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 pip & virtualenv | |
# create a virtual environment for your webapp | |
# install django in the new virtualenv | |
cd ~/tmp | |
PYVE=2.7 | |
PYVER=2.7.3 | |
STVER=0.6c11 | |
# go directly to the source to get the latest and greatest | |
wget http://pypi.python.org/packages/$PYVE/s/setuptools/setuptools-$STVER-py$PYVE.egg#md5=fe1f997bc722265116870bc7919059ea |
View gist:6802139
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
_autorebase 000013-1 | |
_update-info-dir 00236-1 | |
alternatives 1.3.30c-10 | |
autobuild 5.3-1 | |
autoconf 13-1 | |
autoconf2.1 2.13-12 | |
autoconf2.5 2.69-2 | |
automake 9-1 | |
automake1.13 1.13.4-1 | |
automake1.14 1.14-1 |
View simple_cb.py
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
""" White balance (color balance) | |
Adjust colors to flatten color histogram peaks and broaden color spectrum for better color contrast. | |
This is also sometimes called white balancing or probability distribution whitening. | |
References: | |
- Color balance algorithm in [OpenCV](http://www.morethantechnical.com/2015/01/14/simplest-color-balance-with-opencv-wcode/) | |
- Ported to python by [DavidYKay](https://github.com/DavidYKay) | |
- Optimized (`O(N^2)` -> `O(N)`) by @alxrsngartn funded in part by NSF grant number 1722399 to [Aira](http://github.com/aira) (@jmeyers-aira) | |
- Incorporated into [nlpia](github.com/aira/nlpia) by @hobson |
OlderNewer