Skip to content

Instantly share code, notes, and snippets.

💭
🔬

Austin Davis-Richardson audy

💭
🔬
Block or report user

Report or block audy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View infinite-median.py
from collections import defaultdict
import statistics
import random
class InfiniteMedian:
"""
Works well if the number of possible values is low.
Otherwise, nicht sehr gut
"""
@audy
audy / docker-autosleep.sh
Created Feb 27, 2019
Automatically shut down after all docker containers have exited
View docker-autosleep.sh
#!/bin/bash
set -euo pipefail
container_substring="something-greppable-in-the-name"
function check {
docker ps | grep -v CONTAINER | grep -v ${container_substring}
}
@audy
audy / xml-to-dict.py
Created Oct 22, 2018
Convert nested XML data into dictionaries
View xml-to-dict.py
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
from pprint import pprint
import code
tree = ET.parse('biosample_result.xml')
def expand_blob(blob, attributes={}):
'''
@audy
audy / download-genbank.sh
Created Jul 11, 2018
quick way to get all the fasta files for all bacterial genomes
View download-genbank.sh
#!/bin/bash
set -euo pipefail
rm -rf genbank/
rsync \
--archive \
--progress \
--recursive \
@audy
audy / scrape-greengenes.sh
Created Mar 23, 2018
Download all of GreenGenes database from SecondGenome
View scrape-greengenes.sh
#!/bin/bash
set -euo pipefail
function get_source() {
curl --silent "http://greengenes.secondgenome.com/downloads/database/13_5"
}
function get_urls() {
get_source | grep 'https:' | grep s3 | cut -d '"' -f 2
@audy
audy / rargparse.R
Created Feb 8, 2018
Attempting to write an argparse clone in pure R (using R6 classes tho)
View rargparse.R
#!/usr/bin/env Rscript
library(R6)
library(testthat)
Argument <- R6Class('Argument',
public = list(
flag = NA,
help = NA,
View gaga2.go
package main
import (
"os"
"fmt"
"bufio"
)
func main() {
View pcr.py
class DNA:
def __init__(self, sequence: str) -> None:
self.sequence = str(sequence).lower()
@property
def reverse(self) -> 'DNA':
return DNA(self.sequence[::-1])
@property
View scrape.py
#!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup
url = 'http://www.berkeleybowl.com/daily-hot-soup'
res = requests.get(url)
soup = BeautifulSoup(res.content, 'html5lib')
View asdf.rb
class Render
def self.[](engine:)
p engine
end
end
Render[engine: 'doot']
You can’t perform that action at this time.