Skip to content

Instantly share code, notes, and snippets.

aih / options xcdiff
Created Dec 14, 2021
Base options to use in xcdiff
View options xcdiff
// Selectors for mapping sections in document:
// `key` is a selector to match section
// `value` is an array of element selectors to exclude
// from matched section content. Pass empty array or `null`
// to include full content
match: ['xml-meta', 'division', 'part', 'title', 'subtitle', 'chapter', 'section', 'intermediatelevel', 'majorlevel'],
//match: ['part', 'title', 'subtitle', 'chapter', 'section', 'toc', 'tocItem', 'docTitle', 'preamble', 'level', 'recital', 'resolutions', 'conclusions', 'regulation', 'table'],
// Selectors to ignore sections matched by `match` option
ignore : ['section//section', 'section//division', 'section//part', 'section//title', 'section//subtitle', 'section//chapter'],
aih / docker-volume-inspect.txt
Created Nov 24, 2021
Find license path for docker/podman volumes
View docker-volume-inspect.txt
podman volume inspect <volumename>
aih / billsumaries-idea.txt
Created Nov 18, 2021
Bill summaries ML idea
View billsumaries-idea.txt
One long-term idea that would be very interesting and valuable is to train a model to produce bill summaries.
The bill summaries are in XML in bulk at this site:
For example:
In the `summary-text` element, within <![CDATA[ ]]>
aih / catalog.xml
Created Nov 18, 2021
Forms of schema and dtd paths for bills, amendments and resolutions
View catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<!-- DTD -->
<system systemId="res.dtd" uri="schemas/res.dtd"/>
<system systemId="C:\Program Files (x86)\JustSystems\rules\bill.dtd" uri="schemas/bill.dtd"/>
<system systemId="" uri="schemas/bill.dtd"/>
<system systemId="" uri="schemas/amend.dtd"/>
<public publicId="-//US Congress//DTDs/bill.dtd//EN" uri="schemas/bill.dtd"/>
<public publicId="-//US Congress//DTDs/res.dtd//EN" uri="schemas/res.dtd"/>
<public publicId="-//US Congress//DTDs/bill v2.8 20020720//EN" uri="schemas/bill.dtd"/>
aih / files_bigger_than
Created Oct 21, 2021
Command line utility (written by GH Copilot) to list files greater than a certain size
View files_bigger_than
files_bigger_than() {
local file_path="$1"
local size="$2"
local file_size=$(stat -c%s "$file_path")
if [ "$file_size" -gt "$size" ]; then
echo "$file_path"
aih / mac-docker.adoc
Last active Oct 24, 2021
Restart docker on mac
View mac-docker.adoc
$ docker-machine restart default
Restarting "default"...
(default) Check network to re-create if needed...
(default) Waiting for an IP...
Waiting for SSH to be available...
Detecting the provisioner...
Restarted machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

$ docker-machine env default
aih / createdirs.adoc
Created Jul 9, 2021
Create directory with bash expansion
View createdirs.adoc
$ mkdir -p bills/{111..117}/{pdf,dtd,uslm,compare}

$ tree bills

├── 111
│   ├── compare
│   ├── dtd
│   ├── pdf
aih / mac-docker.adoc
Created Jul 9, 2021
Using docker on MacOs
View mac-docker.adoc
docker-machine start
eval "$(docker-machine env default)
aih / CSS for
Last active Dec 23, 2020
How to add styling (CSS) to an XML document
View CSS for

XML in the browser

Browsers generally work with HTML or the XML compatible variant, XHTML. However, they can also support XML, with some caveats. Xcential makes use of this in the LegisPro editor, to display and edit XML directly. We also use it to render XML in the browser with CSS, avoiding costly transformations to HTML.

To style XML, you need to add links to stylesheets (embedded styles may be supported, but not explicitly by the XML specification):

For example, the attached bill.xml is styled with two css files. Place them in the same directory as bill.xml and open bill.xml in a browser. Generally, Firefox works best for this.

View Google Doc to Asciidoctor conversion
# Notes on converting GDoc to Asciidoctor
## GDoc to AsciiDoctor using Java + Google APIs
This method is described here as experimental. I did not try it:
## GDoc to AsciiDoctor script
This method uses a Google Apps script, which adds a menu to your Google Docs. The script and instructions are here: