Skip to content

Instantly share code, notes, and snippets.

@chriswl
chriswl / brew --config
Created November 20, 2012 12:46
Mountain Lion gcc build
$ brew --config
HOMEBREW_VERSION: 0.9.3
HEAD: be10a49527703fd5f3099165e03908b6eeaf9def
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.8.2-x86_64
Xcode: 4.5.2
CLT: 4.5.0.0.1.1249367152
GCC-4.2: build 5666
@chriswl
chriswl / pre_commit_breakpoints.sh
Created January 10, 2013 16:08
git pre-commit hook to check all staged python files for mentioning pdb
# Git pre-commit hook to check all staged python files for mentioning pdb
#
# Installation
#
# ln -s /path/to/pre-commit_breakpoints.sh /path/to/project/.git/hooks/pre-commit
#
# Based on
#
# http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/
# http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes
@chriswl
chriswl / timing_itemgetter.py
Last active December 11, 2015 10:09
timing itemgetter vs. indexing
import timeit
timeit.timeit(stmt= "[a[i] for i in b]", setup = "from operator import itemgetter; import numpy as np; a = list(np.random.random(100)); b = np.random.random_integers(100, size=1000) - 1", number=1000)
timeit.timeit(stmt= "itemgetter(*b)(a)", setup = "from operator import itemgetter; import numpy as np; a = list(np.random.random(100)); b = np.random.random_integers(100, size=1000) - 1", number=1000)
@chriswl
chriswl / doi.ipynb
Last active December 14, 2015 07:08
ipython notebook doi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[[D-people, D-people][WeighMon(C:1(_Friends('x', 'y'),)), WeighMon(C:1(Friends('y', 'x'),)), WeighMon(C:-1.0(Friends('y', 'x'), _Friends('x', 'y')))], [D-people, D-people][WeighMon(C:1(_Friends('x', 'y'), _Smokes('y',))), WeighMon(C:-1.0(_Friends('x', 'y'), _Smokes('x',), _Smokes('y',))), WeighMon(C:1(Friends('x', 'y'), Smokes('x',), Smokes('y',))), WeighMon(C:1(_Friends('x', 'y'), _Smokes('x',)))], [D-people][WeighMon(C:1(Cancer('x',),)), WeighMon(C:1(_Smokes('x',),)), WeighMon(C:-1.0(Cancer('x',), _Smokes('x',)))]]
@chriswl
chriswl / gist:5597694
Last active December 17, 2015 10:49
AL
{
"metadata": {
"name": "Untitled1"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": "Untitled1"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
[
{
"command": "add_breakpoint",
"caption": "Add pudb breakpoint"
}
]
{
"folders":
[
{
"path": "/Users/chriswl/work/pyference"
}
],
"build_systems":
[
{
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{