The ace-svn-to-git.sh
script will use git-svn to convert ACE's Subversion
repository to Git with the --stdlayout
flag so the trunk, tags, and branches
are handled mostly as expected (more below). The --prefix=svn/
option puts
all of those tags and branches under the svn
reference namespace, and the
--authors-file
option maps the Subversion author names to the current GitHub
profiles of the three authors in ACE's history.
When I learned of regular expression engines that support recursion I thought I could write a recursive-descent parser in regex. Since I've written JSON parsers a few times and it's a simple spec, I chose that as the test case. In the end I created two versions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# usage: python3 lark-parsimonious.py [TESTNUM] | |
# | |
# Where TESTNUM is one of: | |
# | |
# 1. Parsimonious with the faster grammar (tree-only) | |
# 2. Parsimonious with the faster grammar (transform data) | |
# 3. Parsimonious with the slower grammar (tree-only) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Copyright 2017 Michael Wayne Goodman <[email protected]> | |
# Licensed under the MIT license: https://opensource.org/licenses/MIT | |
import sys | |
import os | |
import gzip | |
import docopt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
die() { echo "$1"; exit 1; } | |
usage() { | |
cat <<EOF | |
Usage: getargs [--help] [OPTION...] ARGUMENT... | |
Example usage of useful conventions for command-line argument parsing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# quote list: https://en.wikipedia.org/wiki/Quotation_mark | |
QUOTES = ( | |
'\u0022' # quotation mark (") | |
'\u0027' # apostrophe (') | |
'\u00ab' # left-pointing double-angle quotation mark | |
'\u00bb' # right-pointing double-angle quotation mark | |
'\u2018' # left single quotation mark | |
'\u2019' # right single quotation mark | |
'\u201a' # single low-9 quotation mark | |
'\u201b' # single high-reversed-9 quotation mark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def xpath_tokenizer(pattern, namespaces=None): | |
for token in xpath_tokenizer_re.findall(pattern): | |
tag = token[1] | |
if tag and tag[0] != "{" and ":" in tag: | |
try: | |
prefix, uri = tag.split(":", 1) | |
if not namespaces: | |
raise KeyError | |
yield token[0], "{%s}%s" % (namespaces[prefix], uri) | |
except KeyError: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo 'usage: make-preference.sh PROFILE RESULT-ID' | |
exit 1 | |
fi | |
awk -F@ -v RES="$2" \ | |
'{ if($2 == RES) { printf("%d@-1@%d\n", $1, $2) } }' \ | |
< "$1"/result |
Demonstration of an ArcDiagram layout function with variably spaced nodes.
The alice.json
dataset is the first line from Lewis Carroll's
Alice in Wonderland, parsed with
the Stanford Parser.
NewerOlder