Skip to content

Instantly share code, notes, and snippets.

@indraniel
indraniel / plenv-venv
Last active February 1, 2025 06:24
a "virtualenv"-like solution for perl / plenv
#!/usr/bin/env perl
# prior art:
# https://bitbucket.org/jtopjian/penv/src/20bcd9049c95/penv.pl
# https://github.com/stoned/pll/blob/master/pll
use strict;
use warnings;
use Config;
@indraniel
indraniel / init.el
Last active October 11, 2016 21:51
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
;;; from purcell/emacs.d
(defun require-package (package &optional min-version no-refresh)
"Install given PACKAGE, optionally requiring MIN-VERSION.
If NO-REFRESH is non-nil, the available package lists will not be
@indraniel
indraniel / count-lines.clj
Created August 23, 2016 19:19
counting lines in a file
#!/bin/bash lein-exec
;; Taken from http://j.mp/IiT8UK
; (def fib-seq
; ((fn rfib [a b]
; (lazy-seq (cons a (rfib b (+ a b)))))
; 0 1))
;
; (println (take 10 fib-seq))
@indraniel
indraniel / kable.Rmd
Created August 3, 2016 22:44
knitr kable example
```{r kable}
n <- 100
x <- rnorm(n)
y <- 2*x + rnorm(n)
out <- lm(y ~ x)
library(knitr)
kable(summary(out)$coef, digits=2)
```
@indraniel
indraniel / custom-compile-clang.sh
Created August 3, 2016 13:34
compiling llvm/clang on alternative gcc
#!/bin/bash
BASE_BUILD_DIR=/gscmnt/gc2802/halllab/idas/jira/BIO-1915/vendor/llvm
INSTALL_DIR=/gscmnt/gc2802/halllab/idas/jira/BIO-1915/vendor/local
ALT_GCC_DIR=/opt/gcc-4.8.4
ALT_GCC=${ALT_GCC_DIR}/bin/gcc
ALT_GXX=${ALT_GCC_DIR}/bin/g++
setup_llvm_and_clang() {
@indraniel
indraniel / arrow-circles.tex
Last active March 8, 2016 16:42
combinatorics blog post figure tikz sources
\documentclass[border=2mm]{standalone}
\usepackage[sfdefault]{FiraSans}
\usepackage{tikz}
\usetikzlibrary{
positioning, % for the relative node positioning
shapes.multipart, % for the rectangle split
decorations.pathreplacing, % for the brace comments
calc % for the let command
}
@indraniel
indraniel / test.cl
Last active February 10, 2016 00:55
test common lisp SBCL script
#!/usr/bin/sbcl --script
(defun main ()
(if (>= (list-length *posix-argv*) 2)
(format t "~&~S~&" *posix-argv*)
(write-line "Hello, World!")))
;;(main)
(sb-ext:save-lisp-and-die "hello.exe" :toplevel #'main :executable t)
@indraniel
indraniel / Makefile
Last active January 16, 2016 19:44
An example of a LaTeX/knitr report setup containing a git commit revision number
.PHONY: clean
PRJDIR := /path/to/project
DOCS := $(PRJDIR)/docs
RLIBS := /gscmnt/gc2801/analytics/idas/jira/BIO-1465/rpkgs
REPORTDIR := $(DOCS)/writeups
PDFLATEX := /home/archive/texlive-2015/2015/bin/x86_64-linux/pdflatex
writeup: $(REPORTDIR)/report.pdf
@indraniel
indraniel / 1-fetch-na12878-pedigree-metadata.py
Created December 30, 2015 23:12
use lxml to fetch NA12878 Coriell Sample Info
#!/usr/bin/env python
from __future__ import print_function, division
import sys, os, pprint
from glob import glob
import requests
from lxml import html
from toolz.curried import *
#!/usr/bin/env python
# This is a script to merge multiple [GATK][0] Report (or [GATKReport][1])
# files into a single report file. This is useful when one is running multiple
# GATK commands on a partitioned [VCF][2] data set for performance reasons, and then
# afterwards assembling up the overall output.
#
# Currently this script supports the GATKReports for the following
# [VariantEval][3] Evaluation Module [outputs][4]:
#