Skip to content

Instantly share code, notes, and snippets.

View talonsensei's full-sized avatar

talonsensei

View GitHub Profile
@talonsensei
talonsensei / global.R
Created February 20, 2014 17:06 — forked from pssguy/global.R
# load required libraries
library(shiny)
library(plyr)
library(ggplot2)
library(googleVis)
library(reshape2)
####creation of example data on local directory for uploading####
@talonsensei
talonsensei / elapsed_time.py
Created September 16, 2015 20:00
Display elapsed time in human readable format
import time
###############################################
# Returns elapsed time dynamically formatted #
# to accomodate days, hours, minutes, seconds #
###############################################
def elapsed_time(start,end):
# For use with time.time() values as start and end
units = [" days "," hours "," minutes ", " seconds"]
delta = end - start
@talonsensei
talonsensei / Subset RPy2 dataframes
Created July 25, 2013 17:32
How to subset RPy2 data frames by single or multiple criteria
# By single criteria
subset_frame = dataframe.rx(dataframe.rx2('input_type').ro == 'VALUE', True)
# By Multiple Criteria
subset_frame = all_data_frame.rx((dataframe.rx2('input_type').ro == 'VALUE1').ro &
(dataframe.rx2('data_type').ro == 'VALUE2'), True)
@talonsensei
talonsensei / Installing mod_wsgi on Mountain Lion
Created August 20, 2013 17:20
There are apparently changes Apple made in XCode between Lion and Mountain Lion that cause the standard install method to fail. The conventional fix that comes up most often in a Google search at the time of this writing is to create a symlink between the new name of a Toolchain folder and the old name that the installer is supposedly looking fo…
$ ./configure --with-apxs=/usr/local/Cellar/httpd/2.2.25/sbin/apxs --disable-framework
checking Apache version... 2.2.25
checking for python... /usr/local/bin/python
configure: creating ./config.status
config.status: creating Makefile
$ make
26 warnings generated.
/usr/local/Cellar/httpd/2.2.25/share/apache2/build/libtool --silent --mode=link cc -o mod_wsgi.la -rpath /usr/local/Cellar/httpd/2.2.25/libexec -module -avoid-version mod_wsgi.lo -L/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib -L/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -arch x86_64 -lpython2.7 -ldl -framework CoreFoundation
@talonsensei
talonsensei / gist:6371691
Created August 28, 2013 21:40
Homebrew install of Postgres on Mountain Lion
### Install postgres using Homebrew
nauru:~ kaiju$ brew install postgres
==> Downloading http://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar.bz2
Already downloaded: /Library/Caches/Homebrew/postgresql-9.2.4.tar.bz2
==> Patching
patching file src/pl/plpython/Makefile
patching file contrib/uuid-ossp/uuid-ossp.c
==> ./configure --prefix=/usr/local/Cellar/postgresql/9.2.4 --datadir=/usr/local/Cellar/postgresql/9.2.4/share/postgresql --docdir=/usr/local/Cellar/postgresql/9.2.4/share/doc/postgresql --enable-thread-safety
==> make install-world
library("ggtree")
library("dplyr")
library("colorspace")
#Load Tree data
hc_tree<-structure(list(edge = structure(c(11L, 11L, 12L, 13L, 14L, 15L,
15L, 14L, 13L, 16L, 17L, 18L, 19L, 19L, 18L, 17L, 16L, 12L, 1L,
12L, 13L, 14L, 15L, 2L, 3L, 4L, 16L, 17L, 18L, 19L, 5L, 6L, 7L,
8L, 9L, 10L), .Dim = c(18L, 2L)), Nnode = 9L, tip.label = c("XPA.85.007",
"XPA.85.002", "XPA.85.001", "XPA.85.009", "XPA.85.013", "XPA.85.012",
@talonsensei
talonsensei / launcher.cc.diff
Created February 20, 2014 22:04
Diff of launcher.cc from shiny-server showing the changes necessary to make it work on OS X. From https://github.com/nathanweeks/shiny-server/commit/d5240ef6d795dafc89c74a49d6f14d7fe0509541
@@ -1,1 +1,1 @@
/*
* launcher.cc
*
* Copyright (C) 2009-13 by RStudio, Inc.
*
* This program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. This program is distributed WITHOUT
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the