Skip to content

Instantly share code, notes, and snippets.

@comstock
comstock / init.el
Created October 20, 2025 17:01
Emacs colors configuration for better legibility
## Add this config file to ~/.emacs.d/ direcotry
##
;; ---------- Emacs color customization ----------
;; Make blue text easier to read on dark terminals.
(custom-set-faces
'(font-lock-keyword-face ((t (:foreground "DeepSkyBlue3" :weight bold))))
'(font-lock-function-name-face ((t (:foreground "cyan1"))))
'(font-lock-type-face ((t (:foreground "LightGoldenrod"))))
'(font-lock-comment-face ((t (:foreground "LightSalmon3" :slant italic))))
@comstock
comstock / flow_digital_acquisitions.md
Last active December 13, 2024 20:06
flowchart diagram digital acquisitions processing
flowchart TB

%% ACTOR
    P([**REQUESTOR**])
    style P stroke:darkgreen,stroke-width:4px

%% ACTION
    PROC[/PROCCESSING/]
    WORK[/SERVICE PROVIDER ASSIGNMENT/]
@comstock
comstock / mermaid_sequenceDiagram.md
Last active May 8, 2024 15:42
Mermaid Sequence Diagram: On-demand Imaging Workflow
sequenceDiagram

    Title: On-demand imaging workflow
    box lightyellow
    actor P as Patron
    end
    box white
    participant OR as Owning Repository
    end
@comstock
comstock / bitonal_to_lossless_jp2.md
Created April 28, 2023 19:41
Convert bitonal TIFF to 8-bit JPEG2000 (JP2) file

Convert directory of bitonal TIFF files to 8-bit TIFF files

mogrify -format tif -depth 8 ./images_in/*.tif

Convert directory of 8-bit TIFF files to lossless 8-bit JP2 files

opj_compress -OutFor jp2 -ImgDir ./images

@comstock
comstock / curlLibraryCloud.md
Last active December 13, 2023 18:45
Using Harvard Library's LibraryCloud, send a MARC/MODS XML, Dublin Core XML, or MODS JSON version of an item record to standard output.

curl "https://api.lib.harvard.edu/v2/items.[xml | dc | json]?recordIdentifier=[Hollis ID]"

Example, Dublin Core output: curl "https://api.lib.harvard.edu/v2/items.dc?recordIdentifier=990058255550203941"

@comstock
comstock / icc_profile_conversion.md
Last active April 10, 2023 18:55
Example: ICC profile-to-profile conversion using Imagemagick via command-line

Example showing how to perform an ICC profile-to-profile conversion using ImageMagick.

  1. Download test image: wget -O in.tif https://storage.googleapis.com/comstock.cc/icc/ICC_profile_test_image_Farbkreis_120grad.tif
  • Wanna see which ICC profile is embedded in the test image, in.tif? Run: exiftool -ProfileDescription in.tif
  1. Download an ICC profile: wget -O sRGB_ICC_v4_Appearance.icc https://storage.googleapis.com/comstock.cc/icc/sRGB_ICC_v4_Appearance.icc
  • Wanna extract the ICC profile from an image? Run: convert in.tif in.icc
@comstock
comstock / ATOM_LineEndingsSearch.md
Last active March 24, 2022 19:58
Searching for line endings using Atom

select regex search option

\r?\n|\r

keywords: line-feed carriage return

@comstock
comstock / images_to_html_commandline.md
Last active October 20, 2020 12:31
make image webpage from directory of images via commandline.

Images to HTML

  • i2gal

  • llgal

       llgal --clean ; llgal --exif --tx 350 --ty 350 --u --w 2 --p 25 --n --ad --cf --title "Gift Images"
    
  • album

@comstock
comstock / DRS_reports_parsing_with_AWK.md
Last active March 20, 2020 22:50
parsing DRS reports with AWK

Generate a list of DRS URNs from a DRS deposit reports using AWK

"STILL IMAGE" DRS report example:

(Assuming the JP2 files are the only ones in the report to have delivery URNs.)

cat 1584126841-SLPC2033658088718609638479.txt | grep "JP2" | awk '{print "http://nrs.harvard.edu/" $11}' > list_of_image_URNs.txt

"PDS OBJECT" DRS report examples:

  1. The following generates a list of links to the JP2 files referenced in the report.
@comstock
comstock / JPEG_to_PDF.md
Last active March 11, 2020 13:22
Generate single image PDF files ("image-only") from JPEG source images, and combine them into single PDF files via command line.