Skip to content

Instantly share code, notes, and snippets.

View jrherr's full-sized avatar
💭
Probably working

Josh Herr jrherr

💭
Probably working
View GitHub Profile
@brantfaircloth
brantfaircloth / sphinx_to_github.sh
Created January 23, 2011 02:40
Sphinx documentation to github gh-pages without submodules
# assume the following directory structure where contents of doc/
# and source/ are already checked into repo., with the exception
# of the _build directory (i,e. you can check in _themes or _sources
# or whatever else).
#
# proj/
# source/
# doc/
# remove doc/_build/html if present
@stephenturner
stephenturner / Rprofile.R
Created August 12, 2011 03:02
Rprofile.R
# To source this file into an environment to avoid cluttering the global workspace, put this in Rprofile:
# my.env <- new.env(); sys.source("C:/PathTo/THIS_FILE.r", my.env); attach(my.env)
#-----------------------------------------------------------------------
# Load packages, set options and cwd, set up database connection
#-----------------------------------------------------------------------
## Load packages
# require(ggplot2) #plotting
# require(plyr) #data manipulation
@pithyless
pithyless / gist:1208841
Created September 10, 2011 21:49
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

@djaiss
djaiss / hack.sh
Created March 31, 2012 13:41 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@djaiss
djaiss / gist:2938259
Created June 15, 2012 19:13
PHP List of countries
<?php
$countries =
array(
"AF" => "Afghanistan",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@dsparks
dsparks / Heatmap.R
Last active August 19, 2022 06:54
ggplot2 heatmap with "spectral" palette
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("ggplot2", "reshape2", "RColorBrewer")
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Generate a random matrix
# This can be any type of numeric matrix,
# though we often see heatmaps of square correlation matrices.
nRow <- 9
nCol <- 16
@gregpinero
gregpinero / clean_fasta_descs.py
Created October 8, 2012 18:31
Clean up a FASTA file that has unwanted characters in the description lines
import re
infile = 'dsim-all-chromosome-r1.3.reassembly1.updated_wsu1.fasta'
ref_count = 0
for line in open(infile,'r'):
if line.startswith('>'):
ref_count += 1
print '>' + re.sub(r'[^0-9a-zA-Z_]', '', line)[:50]
else:
print line,
@arq5x
arq5x / unique-bash-history.sh
Created January 22, 2013 02:52
Unique BASH history
HISTCONTROL="erasedups"
export HISTCONTROL
@arq5x
arq5x / test_gemini_query.py
Last active December 15, 2015 09:09
Example script using the Gemini query API for custom analysis.
#!/usr/bin/env python
import sys
from gemini import GeminiQuery
db = sys.argv[1]
# create a GeminiQery instance for the requested database
gq = GeminiQuery(db)