Skip to content

Instantly share code, notes, and snippets.

tgs /
Last active May 1, 2019 21:19
Prototype Python library for making error messages that explain complicated conditions
# This is a work-for-hire for the Government of the United States, so it is not
# subject to copyright protection.
logiq - A way to build complex conditions and evaluate them against the world.
The goal is to make the conditions easy to construct, and give them useful and
concise error messages as well.
These are some requirement nodes:
tgs / index.html
Last active November 13, 2017 21:27 — forked from hubgit/index.html
PubMed search with jQuery
<!doctype html>
<meta charset="utf-8">
<title>PubMed Search</title>
<link rel="stylesheet" href="">
<ul id="output"></ul>
<script src=""></script>
<script src="pubmed-search.js"></script>
tgs /
Last active April 19, 2023 16:06
Translate NCBI2na data from hexadecimal to standard bases
#!/usr/bin/env python
Translate compact hex sequence representation to standard bases.
If you have NCBI ASN.1 data, the easiest way to get a FASTA version is to
use NCBI's asn2fasta tool, which is available here:
NCBI2na is a compact representation of sequence data, where each base just
takes 2 bits. It's commonly found in text ASN.1 files as hexadecimal strings.
tgs /
Created November 25, 2015 06:18
see hidden areas in xkcd 1608 - requires, PIL(low), numpy
#!/usr/bin/env python
import StringIO
import numpy as np
from bottle import route
from bottle import run
from bottle import abort
import Image
import requests
tgs / hist_summary.r
Created May 26, 2015 22:20
Add median to ggplot2 histogram
stat_hist_summary <- function (mapping = NULL, data = NULL, geom = "vline", position = "identity",
fun = median, ...) {
StatHistSummary$new(mapping = mapping, data = data, geom = geom,
position = position, fun = fun, ...)
StatHistSummary <- proto(ggplot2:::Stat, {
tgs /
Created April 1, 2015 21:00
py.test: ignore the same files as git when doing test collection
import subprocess
# Usage: put it in the current directory, and run
# py.test -p gitignore [...]
def pytest_ignore_collect(path, config):
if path.basename == '.git': # Ignore .git directory
return True
child = subprocess.Popen(['git', 'check-ignore', str(path)],
tgs /
Last active August 29, 2015 14:09 — forked from anonymous/
#!/usr/bin/env python
# Half-assed fuzzer for HTML strip-tags functions
from __future__ import print_function
BITS = [
'<', '</', '>', '<!--', '-->', 'a', 'div', 'p', 'i',
tgs / Vagrantfile
Last active August 29, 2015 14:04
Vagrantfile for developing edx/configuration
Vagrant.require_version ">= 1.5.3"
unless Vagrant.has_plugin?("vagrant-vbguest")
raise "Please install the vagrant-vbguest plugin by running `vagrant plugin install vagrant-vbguest`"
MEMORY = 2048
tgs /
Last active August 29, 2015 14:01
Star thingy

Zing, pow

Click it to make it go some more

tgs /
Last active August 29, 2015 14:00
Fun twiddly lines

Click it to make it go again.

A d3.js version of the "egyptian" effect used in Tron. A few really fun pages over here by GMUNK were the inspiration.