Skip to content

Instantly share code, notes, and snippets.

View birkin's full-sized avatar

Birkin James Diana birkin

View GitHub Profile
@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>
@birkin
birkin / HH020005_0001_mods.xml
Created November 20, 2023 14:13
hhoag sample item-mods
<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>American Mercury records -- HH020005_0001</mods:title>
</mods:titleInfo>
<mods:typeOfResource authority="primo" authorityURI="https://knowledge.exlibrisgroup.com/Primo/Product_Documentation/020Primo_VE/Primo_VE_(English)/100Loading_Records_from_External_Sources_into_Primo_VE/Configuring_Normalization_Rules_for_External_Resources_(Primo_VE)#Supported_Resource_Types_in_Primo_VE">text_resources</mods:typeOfResource>
<mods:note type="preferredcitation">Item of "American Mercury records, The Gordon Hall and Grace Hoag Collection of Extremist and Dissenting Printed Propaganda, Ms.76.23, Brown University Library"</mods:note>
<mods:language>
<mods:languageTerm type="code" authority="iso639-2b">eng</mods:languageTerm>
<mods:languageTer
@birkin
birkin / update_django_to_pysqlite.sh
Last active January 2, 2024 00:57
hack to get djanto to work with ancient version of sqlite. don't do this at home.
#!/bin/bash
function usage() {
echo "Usage: $(basename "${0}") <full path to repo directory>"
echo
echo "Example: $(basename "${0}") /path/to/github_project_dir"
exit
}
@birkin
birkin / loading_boolean_envars.md
Last active September 8, 2023 14:49
gotcha & solution for loading boolean envars

When false is true!

In a bunch of our projects, there's a DEBUG setting that's a boolean. Here's a gotcha, and corresponding good-practice for settings like this...

problem example

I'll set an environmental variable to false:

birkin@birkinbox-2021 ~ %