Skip to content

Instantly share code, notes, and snippets.

FROM continuumio/miniconda
RUN apt update
RUN apt install -y git build-essential
RUN conda config --add channels defaults --add channels bioconda --add channels conda-forge
RUN conda create -n raseenv prophyle ete3 pysam snakemake-minimal samtools parallel r-optparse pandas seqtk
RUN echo "source activate raseenv" > ~/.bashrc
RUN [ "/bin/bash", "-c", "source activate raseenv && pip install --upgrade git+git://github.com/prophyle/prophyle.git@b55e026" ]
@sbuller
sbuller / pwnd
Created January 24, 2019 18:10
Securely check passwords against https://haveibeenpwned.com/ DB.
#!/bin/bash
while read -sp Password: password; do
echo
sha1=$(printf "$password" | sha1sum -)
range=$(echo $sha1 | cut -b1-5)
rest=$(echo $sha1 | cut -b6-40 | tr 'a-f' 'A-F')
part2=$(echo $rest | cut -b1-8)
@sbuller
sbuller / fizzbuzz.hs
Created September 11, 2017 20:36
An implementation of FizzBuzz inspired by a Tom Scott video
-- borrowed from FSharp
(|>) :: t -> (t -> t1) -> t1
a |> b = b a
-- The game rules:
fizzbuzz :: Integer -> String
fizzbuzz n = let
-- We can create rules that process numbers.
-- The incoming numbers are paired with an accumulated String
rule :: Integer -> String -> (Integer, Maybe String) -> (Integer, Maybe String)
@sbuller
sbuller / gist:2790380
Created May 25, 2012 20:22
Rugged's Tree objects are unsatisfactory. This eases the pain a bit.
require 'rugged'
class TreeProxy < BasicObject
def initialize(repo, tree)
@repo = repo
@tree = tree
end
def _wrap_yield_(*args)
if args.length >= 1 and args[0].class == ::Hash and args[0].has_key? :oid
def format(line, binding)
pattern = /[[:alpha:]\$_][[:alnum:]_]*/
line.gsub(pattern) {|match| replace(match,binding) }
end
def replace(match, binding)
reserved_words = "alias,and,BEGIN,begin,break,case,class,def,defined?,do,else,elsif,END,end,ensure,false,for,if,in,module,next,nil,not,or,redo,rescue,retry,return,self,super,then,true,undef,unless,until,when,while,yield".split(",")
if reserved_words.rindex match
return match
end
@sbuller
sbuller / display.h
Created March 1, 2012 22:15 — forked from sbuller/draw.h
Type based view
#pragma once
class Display {
};
class ncursesDisplay: public Display {
/*
* Print blits images to the output buffer, with an emphasis on font
* rendering. The class passed is the means of selecting the font,
* the particulars of this mechanism are not yet defined.
@sbuller
sbuller / draw.h
Created March 1, 2012 20:35
Type based view
#pragma once
#include <iostream>
#include <string>
using namespace std;
class Draw {
public:
Draw(ostream &out):out(out){}
@sbuller
sbuller / test.html
Created January 26, 2012 22:40
Ember Test
<html>
<head>
<title>Ember Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://github.com/downloads/emberjs/ember.js/ember-0.9.4.min.js"></script>
<script type="text/javascript" src="http://coffeescript.org/extras/coffee-script.js"></script>
</head>
<body>
<h1>Todos</h1>
<script type="text/x-handlebars">