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
| # -*- coding: utf-8 -*- | |
| """ Small script that shows hot to do one hot encoding | |
| of categorical columns in a pandas DataFrame. | |
| See: | |
| http://scikit-learn.org/dev/modules/generated/sklearn.preprocessing.OneHotEncoder.html#sklearn.preprocessing.OneHotEncoder | |
| http://scikit-learn.org/dev/modules/generated/sklearn.feature_extraction.DictVectorizer.html | |
| """ | |
| import pandas | |
| import random |
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
| """ | |
| If you're using Celery with the gevent worker and a Flask app, | |
| you may have noticed that you're unsuccessful in having the | |
| tasks execute within your Flask app's app_context. Normally, | |
| you can do this | |
| with app.app_context(): | |
| celery.start() | |
| ...but...doesn't appear to work with the gevent worker pool. |
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
| # First, find your broadcast address | |
| # | |
| ifconfig | |
| # - Should return something like the below, where 192.168.1.255 is | |
| # - the broadcast address | |
| # - | |
| # - eth0 Link encap:Ethernet HWaddr b8:27:eb:19:c6:01 | |
| # - inet addr:192.168.1.109 Bcast:192.168.1.255 Mask:255.255.255.0 | |
| # - UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 |
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 bash | |
| ########################################################## | |
| # | |
| # This is a shell script for keeping a journal that is | |
| # * plaintext, | |
| # * time-stamped, | |
| # * encrypted, and | |
| # * edited with vim. | |
| # |
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
| GITX="/Applications/GitX.app/Contents/Resources/gitx" | |
| if [[ -x $GITX ]]; then | |
| gitx() { | |
| if [[ ($# -eq 1) && ($1 != "-"*) ]]; then | |
| # If a single arg is given, assume that | |
| # arg is the directory to open. | |
| $GITX --git-dir=$1 | |
| else | |
| # Otherwise pass args to gitx. | |
| $GITX "$@" |
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
| autoload -Uz vcs_info | |
| zstyle ':vcs_info:*' check-for-changes true | |
| zstyle ':vcs_info:*' enable git svn hg | |
| ### git: Show marker (T) if there are untracked files in repository | |
| # Make sure you have added staged to your 'formats': %c | |
| function +vi-git-untracked(){ | |
| if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \ | |
| git status --porcelain | grep '??' &> /dev/null ; then |
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 | |
| # encoding: utf-8 | |
| """ | |
| fingerprint_cluster.py | |
| Based on http://code.google.com/p/google-refine/wiki/ClusteringInDepth | |
| Created by Kyle Jensen on 2010-12-15. | |
| """ | |
| import re |
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
| # Make a new virtual env | |
| # named ninjakitten | |
| mkvirtualenv ninjakitten | |
| cdvirtualenv | |
| # Install readline binary | |
| easy_install -a readline | |
| # Install ipython | |
| pip install -E . ipython |
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
| class HighBaseEncoder(object): | |
| """docstring for HighBaseEncoder | |
| http://stackoverflow.com/questions/1119722/base-62-conversion-in-python | |
| """ | |
| def __init__(self): | |
| super(HighBaseEncoder, self).__init__() | |
| ALPHABET = "23456789abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" |