Skip to content

Instantly share code, notes, and snippets.

View bredelings's full-sized avatar

Benjamin Redelings bredelings

View GitHub Profile
@bredelings
bredelings / crawl.py
Created October 18, 2018 16:26
Silly web crawler
#!/usr/bin/python3
import requests
import time
from threading import Thread
machine='http://localhost:1984'
# machine='https://ot39.opentreeoflife.org'
# machine='https://api.opentreeoflife.org'
@bredelings
bredelings / parse_newick.py
Created August 13, 2020 16:15
How to parse Newick in python using the parsy library
#!/usr/bin/python3
import sys
import re
from parsy import regex, string, success, generate
def newick_quote(s):
newick_quote_level = 0
if " " in s:
newick_quote_level = 1
@bredelings
bredelings / LogDensity.h
Last active June 27, 2024 15:31
A log-density class that counts the number of zeros.
#include <limits>
#include <cmath>
#include <cassert>
#include <iostream>
class LogDensity
{
double zeros_ = 0;
// Cannot be -Inf. Can be +Inf.