Skip to content

Instantly share code, notes, and snippets.

@john2x
john2x / 00_destructuring.md
Last active April 23, 2024 13:18
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@c0ldlimit
c0ldlimit / gist:3f4d20b978f5130c6b10
Created September 2, 2014 03:35
#python sqlite job queue
# http://flask.pocoo.org/snippets/88/
import os, sqlite3
from cPickle import loads, dumps
from time import sleep
try:
from thread import get_ident
except ImportError:
from dummy_thread import get_ident
@meatcar
meatcar / avro+ga4gh.md
Last active January 27, 2023 15:33
These notes should help you undestand Avro, and give you an entrypoint to start understanding the ga4gh API.

What is Avro?

Parsing the ga4gh API requires you first to understand what is Avro.

Avro is a project that allows you to

  • formaly declare and define data structures (schemas in Avro) to be later used in different languages.
  • store data in a file
  • fetch data from a file
@shiva
shiva / FindNim.cmake
Created October 21, 2014 12:47
cmake module for running nimrod compiler
include(CMakeParseArguments)
find_program(NIM_EXECUTABLE nimrod PATHS ENV PATH)
mark_as_advanced(NIM_EXECUTABLE)
# Determine the valac version
if(NIM_EXECUTABLE)
execute_process(COMMAND ${NIM_EXECUTABLE} "--version"
OUTPUT_VARIABLE NIM_VERSION
@shortsightedsid
shortsightedsid / cl-tcpip.lisp
Last active January 15, 2024 02:36
Short guide to TCP/IP Client/Server programming in Common Lisp using usockets
; Short guide to TCP/IP Client/Server programming in Common Lisp using usockets
;
; The main reason for this guide is because there are very few examples that
; explain how to get started with socket programming with Common Lisp that I
; could understand. After spending a day trying, I finally came up with a small
; bit of code that makes it easy to understand the basics. I've written this
; primarily for myself, but should help others get started as well.
; As usual, we will use quicklisp to load usocket.
@shortsightedsid
shortsightedsid / cl-udpip.lisp
Created October 27, 2014 22:01
Short guide to UDP/IP Client/Server programming in Common Lisp using usockets
; Short guide to UDP/IP Client/Server programming in Common Lisp using usockets
;
; The main reason for this guide is because there are very few examples that
; explain how to get started with socket programming with Common Lisp that I
; could understand.
; After working on a short example on TCP, I found the
; need for a UDP tutorial. So, here goes.
; As usual, we will use quicklisp to load usocket.
@cszentkiralyi
cszentkiralyi / vim-sexp-cheatsheet.md
Last active November 10, 2023 10:05
vim-sexp cheatsheet

Prereqs

These are for the combined vim-sexp (https://github.com/guns/vim-sexp) and vim-sexp-mappings-for-regular-people (https://github.com/tpope/vim-sexp-mappings-for-regular-people) plugins. vim-sexp is neat on its own but Tim Pope makes common stuff much easier.

Note that some vim-sexp functionality depends on <LocalLeader> mappings. This is a different leader key than the global leader, and is the variable maplocalleader (instead of mapleader). To see if you have this set, use :echo maplocalleader; if it errors out you'll need to set it, otherwise it will echo the key. If you want to set your LocalLeader to <Space>, you'll need two commands in your .vimrc, since by default <Space> is bound to <Right> in normal mode:

nnoremap <Space> <Nop>
let maplocalleader=" "

TOC

@lindenb
lindenb / Makefile
Created June 18, 2015 10:43
Creating , Serializing data using apache avro and ga4gh schema ( vcf ngs variant json )
.PHONY:all
all: avro-tools-1.7.7.jar schemas-0.5.1/src/main/resources/avro/variants.avpr src/test/TestAvro.java
rm -rf generated
mkdir -p generated
#generate java classes
java -jar $< compile protocol schemas-0.5.1/src/main/resources/avro/ ./generated
#compile classes
javac -d generated -cp avro-tools-1.7.7.jar -sourcepath generated:src generated/org/ga4gh/*.java src/test/TestAvro.java
# archive
jar cvf generated/ga4gh.jar -C generated org -C generated test
@MarioAriasC
MarioAriasC / spark.kt
Last active December 21, 2019 11:22
Word Count with Apache Spark and Kotlin
package org.cakesolutions.spark
import org.apache.spark.SparkConf
import org.apache.spark.api.java.JavaSparkContext
import scala.Tuple2
fun main(args: Array<String>) {
val inputFile = args[0]
val outputFile = args[1]
@lindenb
lindenb / Makefile
Created March 4, 2016 15:28
source code for using java.util.stream with a VCF keywords: ngs vcf VCF stream iteratror variantcontext parallel
HTSJDK=path/to/htsjdk-2.0.1.jar:path/to/apache-ant-1.8.2-bzip2.jar:path/to/commons-compress-1.4.1.jar:path/to/commons-jexl-2.1.1.jar:path/to/commons-logging-1.1.1.jar:path/to/ngs-java-1.2.2.jar:path/to/snappy-java-1.0.3-rc3.jar:path/to/xz-1.5.jar
all:
rm -rf tmp
mkdir -p tmp
javac -d tmp -cp ${HTSJDK}:. Test.java
java -cp ${HTSJDK}:tmp Test path/to/dbsnp_138.b37.vcf