Skip to content

Instantly share code, notes, and snippets.

View birkin's full-sized avatar

Birkin James Diana birkin

View GitHub Profile
@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 ~ % 
@birkin
birkin / source_of_truth.md
Last active August 21, 2023 15:47
data source-of-truth thoughts...

Source of Truth

Just read a great post from long-time code4libber Jonathan Rochkind, [OCFL and “source of truth” — two options][truth].

To give a nutshell summary, it's first useful to be aware of a common web-development pattern, where the 'data' returned by a browser-request comes from an index. That index is an intermediary between the actual source data/file/image, and the webpage a user loads.

Think of the ["Inscriptions of Israel and Palestine" project][IIP] or the ["U.S. Epigraphy" project][USEP]. In both cases, the source-truth of the scholarly data is in xml-files ([example][usep-example]). Knowedgeable trained folk encode data from headstones or other sources into these xml-files.

But when a user performs a search, or loads an inscription-page from the website, the server looks up info from our [solr][solr] indexer.

Static Site Security

Main points...

Non-static websites have a web-server which often receives user-input and then queries other server-tools: databases, search-indexes, queues. The act of user-input triggering reads and writes to server-tools creates vectors for serious vulnerabilities.

Static-sites still (usually) have a web-server -- but because all the web-server does is directly serve out simple files -- whole categories of serious vulnerabilities are eliminated.

But security-vulnerabilities can still exit in static-sites.

prompt...

i know of someone who says the character Rupert Birkin, in the novel "Women in Love" is a misogynist, and another who says the character is admirable. please explain.

response...

Rupert Birkin, a central character in D.H. Lawrence's novel "Women in Love," is complex and has been interpreted in various ways by readers and scholars alike. The novel, which was first published in 1920, is known for its exploration of relationships, social change, and the human psyche. Here are some reasons why opinions about Rupert Birkin may differ:

  1. Depiction of Women and Relationships: Some readers might consider Birkin a misogynist due to his views and behavior towards women. In the novel, Birkin often expresses a desire for a deeper, almost spiritual connection with women, but at times, he appears dismissive of or superior to them. His relationships are fraught with power struggles, and he has a tendency to intellectualize emotions. This has led some readers to view him as unsympathetic towards the e

As of my last knowledge update in September 2021, TensorFlow doesn't have a direct function to perform one-hot encoding on a list of keywords inside a DataFrame. However, you can utilize pandas to preprocess your data before feeding it into a TensorFlow model. Here's a general approach using pandas and sklearn to achieve one-hot encoding for a category of keywords in a DataFrame:

import pandas as pd
from sklearn.preprocessing import MultiLabelBinarizer

# Sample DataFrame
data = {'keywords': [['keyword_a', 'keyword_c'], ['keyword_c', 'keyword_d']]}
df = pd.DataFrame(data)
@birkin
birkin / ezproxy_overview.md
Created June 12, 2023 17:54
EZproxy overview

prompt

give a brief overview of ezproxy

response

As of my last knowledge update in September 2021, EZproxy is a widely-used web proxy server software that facilitates remote access to electronic content, such as e-journals, e-books, and databases. It is particularly popular among libraries, as it enables library patrons to access licensed content remotely, using their library credentials, without the need for VPNs or other more cumbersome remote access solutions.

EZproxy works by rewriting the URLs of the requested resources so that they pass through the proxy server, which is usually hosted by the institution’s library. When a user tries to access a resource, EZproxy checks whether the user is authenticated and authorized to access the content. If the user is authorized, the proxy server connects to the content provider on behalf of the user and delivers the content to the user’s browser.

@birkin
birkin / ok_to_buy_non_tesla_EVs_again.md
Last active June 12, 2023 02:55
recent email to some friends, sparked by GM's recent announcement that it'll adopt the NACS fast-charger plug.

Go Forth and Purchase a non-Tesla EV!

2023-June-11

Hi all,

With the announcement by General Motors this past Thursday that it will adopt the North American Charging Standard (NACS) fast-charger -- giving it access to Tesla's fast-chargers -- I can officially once again whole-heartedly evangelize non-Tesla EVs! (From Ford & GM; Ford announced the same two weeks ago.)

Some of you may remember that a few months ago I had said that I was terribly disappointed that I could no longer freely recommend buying a non-Tesla EV if...