Skip to content

Instantly share code, notes, and snippets.

View jeremy-code's full-sized avatar

Jeremy Nguyen jeremy-code

View GitHub Profile
@jeremy-code
jeremy-code / README.md
Created December 31, 2025 01:26
Dezoomify

Suppose you are using lovasoa/dezoomify-rs to extract an image.

Easiest way would be to use the dezoomify extension (lovasoa/dezoomify-extension), zooming in, clicking on the extension icon, which will pop up the dezoomify website with the url pre-filled.

Alternatively, inspect element, network tab, select XHR or Fetch/XHR and look for a JSON fetch request to a info.json of something like this:

{
  "@context": "http://iiif.io/api/image/2/context.json",
  "@id": "https://numerabilis.u-paris.fr/iiif/2/bibnum:90146x1805x09:0097",
@jeremy-code
jeremy-code / extractImagesFromPage.ts
Created August 23, 2025 03:13
Extract all images from a PDF page using PDF.js
import { OPS, type PDFPageProxy, type ImageKind } from "pdfjs-dist/legacy/build/pdf.mjs";
// https://github.com/mozilla/pdf.js/blob/master/src/core/image.js#L698
type ImageObject = {
width: number;
height: number;
interpolate: undefined;
kind: (typeof ImageKind)[keyof typeof ImageKind];
data: Uint8Array | Uint8ClampedArray;
dataLen: number;
@jeremy-code
jeremy-code / README.md
Created August 8, 2025 07:06
Bulk reading PDF date of creation or other XMP metadata

I had about 2828 files that I wanted to mass read the date of creation from their metadata.

Initially, my thought was to use PDF.js with a structure like this (I am using legacy since I am on Node.js):

import { readFile } from "fs/promises";

import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs";

const file = await readFile(path);
Query successful
Washington, 12th 1841
In compliance with your suggestions this morning, I have the honor to submit considerations and propositions in reference to the debt of Major and Hooe, which I have become responsible for.
I have not entered into any definite arrangement with them, as I did not know the exact amount to be borrowed. Circumstances now compel an arrangement that allows time for them to proportion some part of it. I understand that Hooe will adjust his proportion of the joint obligation, which is the larger portion, and will pay one third of it with you. In any event, I propose to take up the whole debt, including interest, and provide acceptances payable here in New York at six, twelve, and eighteen months.
I also propose that the judgment against them, which has the same name as the original parties, be assigned to me. The world knows it is my purpose to exercise these assignments only to compel them to pay their share. If the time of indulgence is longer, I shall be willing to
@jeremy-code
jeremy-code / README.md
Created July 15, 2025 05:56
Unknown Man Died Eating Library Paste - July 14 1908
https://www.upi.com/Top_News/US/2011/07/12/Archivists-preparing-Robert-Kennedy-papers/58081310486946/
This photograph, part of the John F. Kennedy Presidential Library, taken in 1960 shows Brothers John F. Kennedy, Robert F. Kennedy, and Edward M. Kennedy in Hyannis Port, Cape Cop, Massachusetts. This image is one of the more than 1,500 images that the National Archives has released in their "Access to a Legacy" project, which is an online digital archive of high interest material from President John F. Kennedy's official and personal records. The collection consist of photographs, audio recordings, speech drafts, films and other material. UPI/John F. Kennedy Presidential Library and Museum | License Photo
https://newsroom.ap.org/editorial-photos-videos/detail?itemid=6687d47c68e146d9b261d2cf54cdbdc1&mediatype=photo
Sen. John F. Kennedy and Robert Kennedy
https://newsroom.ap.org/editorial-photos-videos/detail?itemid=6bce0629cf3f43fb88724c0eec26d32b&mediatype=photo
Sen. John F. Kennedy and Robert Ken
@jeremy-code
jeremy-code / README.md
Last active June 7, 2025 03:11
ESLint Plugins
@jeremy-code
jeremy-code / README.md
Last active June 2, 2025 08:22
Promises resolve to the same value

The title kind of sounds like gibberish but wait let me explain.

const main = async () => {
  const promise1 = Promise.resolve(Math.round(Math.random() * 100));
  const promise2 = promise1.then((value1) => value1 + 1);

  const [value1, value2] = await Promise.all([promise1, promise2]);
  // Value 1: 49, Value 2: 50
 console.log(`Value 1: ${value1}, Value 2: ${value2}`);
@jeremy-code
jeremy-code / package.json
Last active June 2, 2025 00:35
husky + lint-staged package.json
{
"name": "libxslt-wasm-demo",
"private": true,
"version": "0.0.0",
"dependencies": {
"husky": "^9.1.7",
"lint-staged": "^16.1.0"
}
}