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
#!/usr/bin/env python | |
import sqlite3 | |
from random import choice | |
from timeit import timeit | |
from itertools import chain | |
con = sqlite3.connect('test_cast.db', isolation_level=None) # autocommit | |
cur = con.cursor() |
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/bash | |
set -e | |
REQFILE="${1-requirements.txt}" | |
WHEELSTREET="${2-wheelstreet}" # base dir for wheel dirs | |
if [[ ! -f "$REQFILE" ]]; then | |
echo "Cannot find requirements file named $REQFILE" | |
echo "Usage: $(basename $0) [requirements.txt] [wheelstreet]" |
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
#!/usr/bin/env Rscript | |
suppressPackageStartupMessages(library(lattice, quietly = TRUE)) | |
suppressPackageStartupMessages(library(latticeExtra, quietly = TRUE)) | |
suppressPackageStartupMessages(library(argparse, quietly = TRUE)) | |
main <- function(arguments){ | |
parser <- ArgumentParser() | |
parser$add_argument('infile') |
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
sshmount () { | |
# Usage: sshmount host directory | |
host=$1 | |
pth=$2 | |
mountpoint=~/mnt/${host}+$(basename $pth) | |
mkdir -p $mountpoint | |
sshfs $host:$pth $mountpoint -oauto_cache,reconnect,defer_permissions,negative_vncache,volname=${host}+$(basename $pth) | |
cd $mountpoint | |
echo "unmount using: umount $mountpoint" | |
} |
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
## Extends Wang, et al, 2007 Fig 1 (pmid 17600086) to show detection threshold at higher coverage | |
## | |
library(lattice) | |
## mu = error rate | |
mu_hp <- 0.0044 | |
mu_nhp <- 0.0007 | |
thresh <- function(N, mu, p=0.001){ |
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
## Use mutual information to define a value separating two | |
## distributions. | |
entropy <- function(x,y){ | |
## shannon entropy of x or joint entropy of x and y | |
if(missing(y)){ | |
freqs <- table(x)/length(x) | |
}else{ | |
stopifnot(length(x) == length(y)) | |
freqs <- table(paste(x,y))/length(x) |
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
;; gist.el | |
;; https://github.com/defunkt/gist.el | |
;; added as a submodule: | |
;; % git submodule add https://github.com/defunkt/gist.el.git | |
;; now, to clone .emacs.d elsewhere: | |
;; % git clone git@github.com:nhoffman/.emacs.d.git | |
;; % cd .emacs.d | |
;; % git submodule init && git submodule update | |
(condition-case nil | |
(require 'gist "~/.emacs.d/gist.el/gist.el") |
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
import os | |
import sys | |
import ConfigParser | |
from os import path, environ | |
import glob | |
import itertools | |
venv = environ.get('VIRTUAL_ENV') | |
if not venv: | |
sys.exit('--> an active virtualenv is required'.format(venv)) |
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/bash | |
# try me out: | |
# two processors | |
# $ echo {1..9} | xargs -n1 -P2 ./ps.sh | |
# four processors | |
# $ echo {1..9} | xargs -n1 -P4 ./ps.sh | |
# sleeptime set to a random integer between 2 and 5 | |
sleeptime=$(shuf -i 2-5 -n 1) |
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
#!/usr/bin/env python | |
import re | |
import sys | |
rexp = re.compile(r'|'.join([ | |
r'\bactinomycete\b', | |
r'\bcrenarchaeote\b', | |
r'\bculture\b', | |
r'\bchimeric\b', |
OlderNewer