Skip to content

Instantly share code, notes, and snippets.

Vince Buffalo vsbuffalo

Block or report user

Report or block vsbuffalo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vsbuffalo
vsbuffalo / pairwise_cov.r
Created Mar 1, 2019
comparing two implementations of covariance with pairwise complete cases
View pairwise_cov.r
library(tidyverse)
library(MASS)
pcov <- function(x) {
xs <- scale(x, scale=FALSE)
dd <- as.integer(!is.na(x))
dim(dd) <- dim(x)
denom <- (t(dd) %*% dd) - 1L
no_obs <- denom == 0L
xs[is.na(xs)] <- 0
View closure.R
library(purrr)
foo <- function(x) {
return(function(y) {
y + x
})
}
args <- list(1, 2)
foos_map <- map(args, foo)
@vsbuffalo
vsbuffalo / foo.R
Created Apr 13, 2016
23andme and bioc blog post
View foo.R
Title: Using Bioconductor to Analyze your 23andme Data
Bioconductor is one of the open source projects of which I am most
fond. The documentation is excellent, the community wonderful, the
development fast-paced, and the software *very* well written.
There's a new package in the development branch (due to be released as
2.10 very soon) called `gwascat`. `gwascat` is a package that serves
as an interface to the [NHGRI's](http://www.genome.gov/) database of
genome-wide association studies.
@vsbuffalo
vsbuffalo / .ycm_extra_conf.py
Created Mar 2, 2016
example YouCompleteMe file
View .ycm_extra_conf.py
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
@vsbuffalo
vsbuffalo / trashpanda.R
Created Nov 9, 2015
get some sweet trashpanda pictures <3 trash panda
View trashpanda.R
trashpanda <- function() {
if (!require('ecoengine')) {
install.packages("ecoengine", dependencies = TRUE)
library(ecoengine)
}
view_photos(ee_photos(scientific_name = "Procyon lotor", quiet = TRUE))
}
@vsbuffalo
vsbuffalo / Makefile
Last active Nov 28, 2018
finally, a LaTeX makefile that captures your anger and frustration
View Makefile
# Thanks https://github.com/EBI-predocs/latex-thesis/blob/master/Makefile for
# some tips
LATEXMK = latexmk -xelatex
# CONFIG
target = manuscript
references = bib.bib
# SETUP
includes := $(shell ls *.tex) ${references}
View gist:04ad93826edb6525ec6f
For every minute you are angry, you lose sixty seconds of happiness. ::: unknown
Anger is a momentary madness, so control your passion or it will control you. ::: Horace Walpole
When angry, count ten before you speak; if very angry, a hundred. ::: Jefferson
Anger is a wind which blows out the lamp of the mind. ::: Robert G. Ingersoll
Holding on to anger is like grasping a hot coal with the intent of throwing it at someone else; you are the one getting burned. ::: Buddha
The best remedy for a short temper is a long walk. ::: Jacqueline Schiff
@vsbuffalo
vsbuffalo / draw_lineage.js
Created Sep 5, 2015
example standlone d3 svg image generator
View draw_lineage.js
var fs = require('fs');
var d3 = require('d3');
var jsdom = require('node-jsdom');
var xmlserializer = require('xmlserializer');
var margin = {top: 2, right: 4, bottom: 2, left: 4};
var width = 200 - margin.left - margin.right,
height = 14 - margin.top - margin.bottom;
View gist:12b19045028377920a49
augroup Terminal
au!
au TermOpen * let g:last_terminal_job_id = b:terminal_job_id
augroup END
function! REPLSend(lines)
call jobsend(g:last_terminal_job_id, add(a:lines, ''))
endfunction
command! REPLSendLine call REPLSend([getline('.')])
@vsbuffalo
vsbuffalo / coal.js
Created Apr 21, 2015
dancing genealogies
View coal.js
function range(from, to, by) {
var by = typeof(by) === 'undefined' ? 1 : by;
var out = [];
for (var i = from; i <= to; i += by) out.push(i);
return out;
}
function sampleArrayWithoutReplacement(x, n) {
n = typeof x === 'undefined' ? 1 : n;
You can’t perform that action at this time.