Skip to content

Instantly share code, notes, and snippets.

@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)
#!/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]:
#
@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 / 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 / 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 / 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 / plenv-venv
Last active November 2, 2016 22:17
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 / simple-tsv-parsing.clj
Created November 28, 2016 23:49
simple tsv parsing experiments in clojure
user=> (->> (line-seq (io/reader "test-data.tsv"))
#_=> (map #(string/split % #"\t"))
#_=> (map #(nth % 0))
#_=> (map #(Integer/parseInt %))
#_=> (+))
ClassCastException Cannot cast clojure.lang.LazySeq to java.lang.Number java.lang.Class.cast (Class.java:3369)
user=> (->> (line-seq (io/reader "test-data.tsv"))
#_=> (map #(string/split % #"\t"))
#_=> (map #(nth % 0))
@indraniel
indraniel / test.cpp
Created December 12, 2016 02:46
Example Simple C++ logging (w/o C++11 or later)
#include <iostream>
#include <ctime>
void logMsg( const std::string& msg ) {
time_t rawtime;
struct tm * timeinfo;
char buffer[80];
time (&rawtime);
timeinfo = localtime(&rawtime);
@indraniel
indraniel / application.conf
Last active March 20, 2017 19:52
Example Cromwell / WDL usage at the MGI
webservice {
port = 8000
interface = 0.0.0.0
instance.name = "reference"
}
akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
actor {
default-dispatcher {