Skip to content

Instantly share code, notes, and snippets.

View terrycojones's full-sized avatar

Terry Jones terrycojones

View GitHub Profile
C-x C-f runs the command ido-find-file, which is an interactive autoloaded
compiled Lisp function in ‘ido.el’.
It is bound to <open>, C-x C-f, <menu-bar> <file> <new-file>.
(ido-find-file)
Edit file with name obtained via minibuffer.
The file is displayed according to ‘ido-default-file-method’ -- the
default is to show it in the same window, unless it is already visible
(eval-when-compile
(require 'my-oe))
(and
(boundp 'i-use-oe)
i-use-oe
(require 'my-oe)
(oe-open)
(oe-alive-p)
(add-hook 'find-file-hooks 'oe-send-current-file))
def draw(tree, label_func=str, do_show=True, show_confidence=True,
# For power users
axes=None, branch_labels=None, label_colors=None,
*args, **kwargs):
if label_colors:
if callable(label_colors):
def get_label_color(label):
return label_colors(label)
else:
brew uninstall --force gcc
rm -f /usr/local/bin/gcc
brew tap homebrew/versions
brew install gcc49
ln -s /usr/local/bin/gcc-4.9 /usr/local/bin/gcc
ln -s /usr/local/bin/gfortran-4.2 /usr/local/bin/gfortran
mkvirtualenv -p /usr/local/bin/python3 lm35
pip install numpy
pip install scipy

Bayes is cool!

From the introduction to An Intuitive Explanation of Bayes' Theorem:

Your friends and colleagues are talking about something called "Bayes' Theorem" or "Bayes' Rule", or something called Bayesian reasoning. They sound really enthusiastic about it, too, so you google and find a webpage about Bayes' Theorem and... >

$ ls -la /usr/local/bin/gcc*
lrwxr-xr-x 1 terry admin 7 Aug 6 2014 /usr/local/bin/gcc -> gcc-4.9
lrwxr-xr-x 1 terry admin 46 Sep 21 2014 /usr/local/bin/gcc-4.2 -> ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
lrwxr-xr-x 1 terry admin 33 Jan 14 10:04 /usr/local/bin/gcc-4.9 -> ../Cellar/gcc/4.9.2_1/bin/gcc-4.9
lrwxr-xr-x 1 terry admin 36 Jan 14 10:04 /usr/local/bin/gcc-ar-4.9 -> ../Cellar/gcc/4.9.2_1/bin/gcc-ar-4.9
lrwxr-xr-x 1 terry admin 36 Jan 14 10:04 /usr/local/bin/gcc-nm-4.9 -> ../Cellar/gcc/4.9.2_1/bin/gcc-nm-4.9
lrwxr-xr-x 1 terry admin 40 Jan 14 10:04 /usr/local/bin/gcc-ranlib-4.9 -> ../Cellar/gcc/4.9.2_1/bin/gcc-ranlib-4.9
var wsuri = "ws://127.0.0.1:8080/ws";
var connection = new autobahn.Connection({
url: wsuri,
realm: "realm1",
use_deferred: jQuery.Deferred
});
var jqueryReady = jQuery.Deferred();
var routerReady = jQuery.Deferred();
#!/bin/bash
# A Git pre-commit hook.
#
# To install:
#
# $ cd .git/hooks
# $ ln -s ../../bin/pre-commit.sh pre-commit
# Add our virtualenv bin to PATH. Git commit seems to muck with PATH :-(
def checkAlphabet(self, count=10):
"""
"""
alphabet = Read.checkAlphabet(self, count)
if len(self) > 10 and alphabet.issubset(set('ACGT')):
raise ...
# using the new-style classes super():
def checkAlphabet(self, count=10):
from collections import Counter, defaultdict
class ConfusionMatrix(object):
def __init__(self, trueLabels, clusterLabels):
self._counts = defaultdict(Counter)
self.allLabels = set(trueLabels + clusterLabels)
for trueLabel, clusterLabel in zip(trueLabels, clusterLabels):
self._counts[trueLabel][clusterLabel] += 1
def __getitem__(self, item):