Skip to content

Instantly share code, notes, and snippets.

// Helper functions
// A list consists of any number of 'rule', separated by separator, and the last one is optional.
const list = (rule, separator) => seq(rule, repeat(seq(separator, rule)))
const NL = choice("\r\n", "\r", "\n")
const NLOPT = prec(-1, repeat(NL))
// in ascending order of precedence
const operator_table = [
@fwip
fwip / confetti.p8
Created July 27, 2019 23:32
an example on how to draw confetti in pico-8
function create_confetti()
v=1.4 --initial velocity
size=40
-- the center of the confetti
balloon_x=40
balloon_y=40
for i=1,100 do
local r=rnd(size) -- this is how far out from the center it starts
local n=rnd(1) -- this is the angle it goes at
confetti[i] = {
package locale
import (
"bufio"
"fmt"
"io"
"regexp"
"strconv"
"strings"
"unicode/utf8"
package main
import (
"encoding/csv"
"fmt"
"io"
"log"
"os"
)
#!/usr/bin/env python3
from Bio import SeqIO
from collections import defaultdict
import time
M = 7
Q = 10
#!/bin/bash
for fastq in $SAMPLE_NAME*.fastq.gz; do
zcat $fastq \
| awk '/Y/' \
`basename $fastq .gz` >filtered_
done
#include <iostream>
#include <vector>
#include <random>
std::random_device rd;
std::mt19937 rng(rd());
const int ITERATIONS = 300;
const int IN_SIZE = 1000000;
# Normal layout of a healthy read-pair.
fragment ========================================
fragment + adaptors ~~~========================================~~~
SE read --------->
PE reads R1---------> <---------R2
unknown gap ....................
@fwip
fwip / 4d6drop.rb
Created December 12, 2012 17:20
Example script that calculates the probability of getting each score in a "roll 4 six sided dice, drop the lowest, then sum" scheme.
#!/usr/local/bin/ruby
# Calculates the distribution of 4d6, drop lowest
scores = {}
(1..6).each do |i|
(1..6).each do |j|
(1..6).each do |k|
(1..6).each do |l|
dice = [i, j, k, l].sort
dice.shift
@fwip
fwip / badthingshappen.dec
Created May 13, 2012 02:35
Torpor Orb = allstar
* Artifacts
4 Torpor Orb
2 Mimic Vat
* Creatures
4 Vexing Devil
4 Treacherous Pit-Dweller
4 Demonlord of Ashmouth
* Spells and shit