Skip to content

Instantly share code, notes, and snippets.

@blakehurlburt
blakehurlburt / Main.java
Created July 23, 2021 01:57
TTML XPath example
public final class Main {
public static void main(String[] args) throws Exception {
XPath xpath = XPathFactory.newInstance().newXPath();
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(new InputSource(new FileInputStream("ReplaceWithYourTtmlFile.ttml")));
Node metadata = (Node) xpath.compile("/tt/head/metadata").evaluate(document, XPathConstants.NODE);
System.out.println(nodeToString(metadata));
@blakehurlburt
blakehurlburt / robinhood_csv.py
Last active January 13, 2021 05:14
Export current Robinhood stock holdings as CSV
#!/usr/bin/env python3.5
import json
import os
import pickle
import robin_stocks
debug = print
def print_data(data):
@blakehurlburt
blakehurlburt / regex.py
Last active March 1, 2018 00:02
Checks to see if two regexes match the same language (low error but no guarantee)
### Author: Blake Hurlburt
### This program takes in two regular expressions and tries to determine
### whether they recognize the same language.
### If the universe is small enough, it tests the entire universe;
### otherwise, it tests a random sample from the universe.
import itertools as it
import re
import random
import threading
CXX=g++
CXXFLAGS=-std=c++11 -Werror -O0 -g3
all: A0
runtests: test0 test1 test2 test3 test4 test5 test6 test7 test8
test0: A0
./A0 input0.txt output0.txt 1234 && diff output0.txt output0-soln.txt