Skip to content

Instantly share code, notes, and snippets.

View wasade's full-sized avatar

Daniel McDonald wasade

View GitHub Profile
@wasade
wasade / pre-commit
Created March 18, 2014 01:17
PEP8 git pre-commit hook, adapted from https://gist.github.com/lentil/810399. The specific change was to stash any uncommited changed prior to executing pep8.
#!/usr/bin/env python
from __future__ import with_statement
import os
import re
import shutil
import subprocess
import sys
import tempfile
@wasade
wasade / subsample.c
Created March 25, 2014 15:19
Rapid subsampling
#include <gsl/gsl_rng.h>
#include <math.h>
#include "subsample.h"
/* subsample_col
*
* desc: subsample an array of COO objects, of length size, to a sum of (n)
*
* inputs: COO* list - an array of COO objects
* COO* ss_result - store the subsampled result
@wasade
wasade / parse_fasta.ipynb
Created April 9, 2014 15:24
Cythoning of parse fasta
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wasade
wasade / SharedOTUs.ipynb
Created June 27, 2014 23:04
Shared OTUs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wasade
wasade / ag_bb.ipynb
Created January 15, 2015 10:36
Beyond Bacteria start
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wasade
wasade / stupid.sh
Created January 20, 2015 19:13
stupid for loop examples
# rename some files based on some counter
x=0 # set an environment variable for our counter
for i in foo/* # for every file in the foo directory
do
# we're going to rename the file, and prefix it with the value in the
# counter. the variable $i will contain both the directory foo, as well as
# the filename (e.g., foo/bar). Since we want to prefix the number on to
# the filename, we need to somehow strip out the foo/ part. we can do this
# using a program called basename (it's worth a peak at its man page).
@wasade
wasade / gg_copy_test.ipynb
Created July 31, 2015 15:34
Benching cogent's TreeNode.copy method
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wasade
wasade / version_update.sh
Created May 1, 2012 23:59
version updater for biom-format
#!/bin/bash
OLD_VERSION=$1
NEW_VERSION=$2
cd trunk/examples
sed -ie "s/Biological Observation Matrix $OLD_VERSION/Biological Observation Matrix $NEW_VERSION/" *.biom
cd ../scripts
sed -ie "s/^__version__ = \"$OLD_VERSION\"/__version__ = \"$NEW_VERSION\"/" *.py