Skip to content

Instantly share code, notes, and snippets.

View birkin's full-sized avatar

Birkin James Diana birkin

View GitHub Profile
@birkin
birkin / llm_summarization_notes.md
Last active October 25, 2024 02:52
IPLC Discovery-Day 2024-October notes
@birkin
birkin / make_tsv.py
Created August 27, 2024 19:13
convert two lines of data to tsv
### convert the two rows of data to a tsv file using the python csv module
import csv
original_two_lines = [
['id', 'jacket_id', 'firstname', 'lastname', 'shortID', 'title', 'pub_date', 'image', 'role', 'dept', 'dept2', 'dept3', 'active', 'created_at', 'updated_at'],
['10', '10', 'First', 'Last', 'flast', 'the long title', '2015', 'flast.jpg', 'author', 'Political Science', 'International and Public Affairs', 'y', '', '', '']
]
with open('data.tsv', 'w') as tsvfile:
@birkin
birkin / check_xml_catalog.py
Last active August 19, 2024 18:15
check xml catalog
"""
Validates against internal mods xml-schema, indicating whether xmlcatalog is used.
"""
import os, unittest
from lxml import etree
import requests
class StrictCatalogResolver(etree.Resolver):
@birkin
birkin / validate_xmlschema_no_network.py
Created July 10, 2024 11:25
code to validate xml agains XSD schema with no network access.
import os
from lxml import etree
def validate_xml_with_schema( xml_filepath: str, xsd_filepath: str ) -> None:
"""
Validates an XML file against an XSD schema, without network access.
Confirms that:
- xmlcatalog is routing the schema location to the local file system
- the C `libxml2` library used by lxml does auto-default to the standard server's `xml/catalog` file.
"""
To add to server run_tests to ensure xmlcatalog is properly configured, and properly being called.
A MODS file likely be the best candidate for the `xml_filepath`.
"""
import os
from lxml import etree
def validate_xml_with_schema( xml_filepath: str, xsd_filepath: str ) -> None:
@birkin
birkin / stuff_i_did_2023.md
Last active April 1, 2024 18:18
highlights of 2023 work -- #stuff
@birkin
birkin / nim-discord-question.md
Last active February 28, 2024 21:47
cross-compilation question (mac to redhat-linux)

(vacation-day experimentation)

(i posted an abbreviated version of this question to [Nim-Discord])

I've been experimenting with nim and am really enjoying it.

Now I want to get compile a binary to run on a Red Hat 7.9 server, and haven't gotten that to work, and would love a few links to some favorite writeups.

Some info, in case it's useful:

@birkin
birkin / bashrc_additions
Last active March 28, 2024 17:13
server-terminal configuration customizations
## ------------------------------------------------------------------
## birkin config
## ------------------------------------------------------------------
## aliases ----------------------------------------------------------
alias cp="cp -i"
alias ls="ls -ahlF"
alias mv="mv -i"
alias rm="rm -i"
@birkin
birkin / record.xml
Created February 7, 2024 14:51
marc-record containing bookplate info
<record>
<leader>01226nam a2200313Ia 4500</leader>
<controlfield tag="005">20080522191149.0</controlfield>
<controlfield tag="008">050630s2005 nyu 000 1 eng</controlfield>
<controlfield tag="001">991003874639706966</controlfield>
<datafield tag="010" ind1="" ind2="">
<subfield code="a">2005018927</subfield>
</datafield>
<datafield tag="020" ind1="" ind2="">
<subfield code="a">0811215881 (alk. paper)</subfield>
@birkin
birkin / HH001545.mods.xml
Created January 17, 2024 17:38
sample org-MODS for question about "Part 1" and "Part 2"
<mods:mods xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/mods/v3/mods-3-7.xsd">
<mods:titleInfo>
<mods:title>Time Magazine, Inc.</mods:title>
</mods:titleInfo>
<mods:name type="personal" authority="naf" valueURI="http://id.loc.gov/authorities/names/n50048448" authorityURI="http://id.loc.gov/authorities/names.html">
<mods:namePart>Luce, Henry R.</mods:namePart>
<mods:namePart type="date">1898-1967</mods:namePart>
<mods:role>
<mods:roleTerm type="text" authority="marcrelator">founder</mods:roleTerm>
</mods:role>