Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
print "Hello World!\n";
exit(0);
@indraniel
indraniel / sff2fastq-main.c
Created July 7, 2012 19:42
modification to sff2fastq's main.c to highlight/debug the trimming read points in a SFF file
/* N O T E S ******************************************************************/
/*
substitute this file for the main.c in the sff2fastq project. Upon
recompliation you then try the following command:
sff2fastq -n <sff-file>
This will add an extra debugging line in the FASTQ output like:
@indraniel
indraniel / tumblr-download.go
Last active September 5, 2021 06:36
A golang program to download pictures from a tumblr blog page
/*
This is a go program to download pictures from a tumblr blog page.
To Build:
go build -o tumblr-download tumblr-download.go
To Run:
# download the photos on the first page of tumblr blog
@indraniel
indraniel / gist:865818e29fb806c5907e
Created January 26, 2015 04:06
Playing around with golang's reflection package. Based on reading http://blog.golang.org/2011/09/laws-of-reflection.html
package main
import "reflect"
import "fmt"
type T struct {
A int
B float64
C int32
D string
@indraniel
indraniel / confusion-matrix.tex
Last active August 29, 2015 14:14
A basic bare-bones 2x2 contingency table, or confusion matrix
\documentclass{standalone}
% setup an alternative font
\usepackage[T1]{fontenc}
\usepackage[charter]{mathdesign} % Math font
\usepackage[sfdefault]{FiraSans} % Sans-serif font
% for the drawings
\usepackage{tikz}
package main
// v1 -- decoding JSON via a simple map
import (
"encoding/json"
"fmt"
"log"
"strings"
"time"
@indraniel
indraniel / serve.go
Last active August 29, 2015 14:15
A rudimentary file and directory server
/* See other alternatives as well:
https://github.com/rif/spark
https://github.com/mholt/caddy
https://github.com/GokulSrinivas/go-http
*/
package main
import (
"flag"
@indraniel
indraniel / tar-gz-reader.go
Created February 23, 2015 19:05
Reading through a tar.gz file in Go / golang
package main
import (
"archive/tar"
"compress/gzip"
"flag"
"fmt"
"io"
"os"
)
@indraniel
indraniel / check.go
Last active August 29, 2015 14:16
check if a file exists on the file system
// approach 1
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
// approach 2
if _, err := os.Stat("/path/to/whatever"); err == nil {
// path/to/whatever exists
}
@indraniel
indraniel / toy-bleve-example.go
Last active October 9, 2023 13:05
This is a toy search example using bleve. It also highlights how to retrieve the orignal input document(s) from the KV store.
package main
// mentioned in bleve google group
// https://groups.google.com/forum/#!topic/bleve/-5Q6W3oBizY
import (
"encoding/json"
"fmt"
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/document"