Skip to content

Instantly share code, notes, and snippets.

View DonRichards's full-sized avatar

Don Richards DonRichards

View GitHub Profile
@DonRichards
DonRichards / check_port.sh
Created April 10, 2024 17:57
Troubleshooting isle-dc build conflicts.
#!/bin/bash
DOCKER_COMPOSE_FILE="docker-compose.yml"
# Check if docker-compose file exists
if [ ! -f "$DOCKER_COMPOSE_FILE" ]; then
echo "Docker Compose file not found at $DOCKER_COMPOSE_FILE"
exit 1
fi
# Extract ports from the 'ports' section of 'traefik' service
#!/bin/bash
# DRAFT: untested at the moment
# FITS File Processor for Dataverse Upload
# -----------------------------------------
# This script iterates through each .fits file in the specified directory, extracts the star number from
# the file name, and uses this information to construct a JSON payload. It then executes a curl command
# to upload each file to a specified Dataverse server using the provided API token and Persistent ID.
# The output of each curl command, along with relevant data, is logged to 'log.txt' for record-keeping
# and debugging purposes.
@DonRichards
DonRichards / Prewarn_IIIF_Cache.md
Last active October 2, 2023 20:01
Script to warm the IIIF cache by PID. This looks is a specific viewer is on the page to fetch the URL to start preheating (warming) the cache.

urls_to_prewarm.py

This script is designed to "pre-warm" the cache of a Cantaloupe IIIF server by sending requests to specified image URLs with multiple IIIF endpoints. The script reads image URLs from a provided text file, combines each URL with a set of IIIF endpoints, and then sends concurrent requests to the server to access and cache these images. By doing so, it ensures that the specified images are readily available in the server's cache for faster subsequent access. The script also includes error handling for missing or empty input files and provides a help menu for user guidance.

preheat.sh

More or less the same as the python script.

Review

To fetch a list of frequently accessed IIIF assets. (Untested)

cat access.log | grep "/iiif/2/" | awk '{print $7}' | sort | uniq -c | sort -n
@DonRichards
DonRichards / dspace_queries.md
Last active September 25, 2023 20:56
Useful DSpace sql queries

Recently Created (within 30 days) that are missing TN files

SELECT 
    h.handle
FROM 
    handle h
JOIN
    item i
ON
    h.resource_id = i.uuid
@DonRichards
DonRichards / Grab_media_file_url_paths.md
Last active September 12, 2023 18:27
Use IDC's Metadata export CSV file to find and pull the Original File's URL path into the CSV.

Grab.py retrieves URLs for either "Intermediate Files" or "Original Files" and appends them to a CSV file.

The script includes a feature for resuming its progress in case of an interruption or error. As a precaution, it adjusts the URLs from the production server to redirect them to a staging server.

Additionally, the script incorporates error-handling mechanisms, utilizing a try-catch-retry approach, to gracefully manage timeouts.

Setup to run

python3 -m venv .venv
source .venv/bin/activate
@DonRichards
DonRichards / get_all_taxonomy_terms.sh
Last active March 20, 2023 18:07
Export all taxonomy terms for Islandora 2.x
#!/usr/bin/env bash
# This generates the header bases by what terms were returned.
# This makes merging them complicated.
curl https://islandora.traefik.me/content/taxonomy-terms/export > taxonomy_terms_000.csv
for i in {1..10000..100}
do
echo "Loop $i"
@DonRichards
DonRichards / A_script_to_Git_all_the_repos.md
Last active February 15, 2023 15:22
Clones and or pulls the latest updates Org Repos into current working directory. If you just want to go down all the directories you already have and pull the latest from the current branches use this instead: find . -type d -depth 1 -exec git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \;

Get all of the repos

It downloads all of the repos for a person or organization.

Starting diagnostics
[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0004: is the Docker engine running?
@DonRichards
DonRichards / how-to-download-lynda.md
Created October 11, 2016 20:05
How to Download Lynda with youtube-dl

How to Download Lynda with youtube-dl with an organization login

Needed:

Cookies Export youtube-dl

  • Install Cookies Export
  • Login to Lynda and navigate to the course you want
  • Cookies export button in browser
  • Copy "cookie.txt" to your desktop
@DonRichards
DonRichards / Gmail_Delete_Old_Emails.md
Created October 7, 2016 13:15
Gmail: Delete old Emails with specific label

How to delete old emails in Gmail

This script will delete emails old than 30 days with a specified label.

Focussing on emails that are from a mailing list I signed up for. I used Gmails filters to move specific email to a label called "Mailing List". You can set the label to "inbox" if you'd like but this would delete everything in your inbox older than 30 days.

Move emails to a "Mailing List" label

To protect your inbox I suggest moving emails you know are safe to delete to a new label.

  • From your inbox click the checkbox next to the email > More > "Filter Messages Like this"
  • Select how this filter selects the email (either From, Subject, To, etc)