Skip to content

Instantly share code, notes, and snippets.

View DonRichards's full-sized avatar

Don Richards DonRichards

  • Johns Hopkins University
  • Knoxville, TN
  • 00:57 (UTC -04:00)
  • X @highlander411
View GitHub Profile
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 / log
Last active December 19, 2022 21:52
make up
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5600 100 5600 0 0 13078 0 --:--:-- --:--:-- --:--:-- 13053
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1704 100 1704 0 0 5063 0 --:--:-- --:--:-- --:--:-- 5071
Building Drupal image with base: ghcr.io/jhu-sheridan-libraries/idc-isle-dc/drupal:upstream-20200824-f8d1e8e-83-g8c8a6b4
[+] Building 43.9s (13/13) FINISHED
=> [internal] load build definition from Dockerfile 0
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 / 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 / github_rate_limit.sh
Last active November 11, 2022 15:27
Github Rate Limited Checker / Delayer
#!/usr/bin/env bash
set -e
: '
author :DonRichards
date :20221020
usage :bash github_rate_limit.sh
Description:
This is an example of how to check Githubs rate limit and wait for it to reset.
This is really useful for those rare cases where you are running a script that
idc-solr-1 | fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
idc-solr-1 | fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
idc-solr-1 | (1/2) Installing libproc (3.3.17-r0)
idc-solr-1 | (2/2) Installing procps (3.3.17-r0)
idc-solr-1 | Executing busybox-1.33.1-r8.trigger
idc-solr-1 | OK: 202 MiB in 106 packages
idc-solr-1 | OK: 202 MiB in 106 packages
idc-drupal-1 | fastcgi_param DRUPAL_DEFAULT_SOLR_HOST "solr";
idc-drupal-1 | DRUPAL_DEFAULT_SOLR_HOST=solr
idc-drupal-1 | - Downloading drupal/search_api_solr (4.2.1)
idc-solr-1 | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
idc-solr-1 | [s6-init] ensuring user provided files have correct perms...exited 0.
idc-solr-1 | [fix-attrs.d] applying ownership & permissions fixes...
idc-solr-1 | [fix-attrs.d] done.
idc-solr-1 | [cont-init.d] executing container initialization scripts...
idc-solr-1 | [cont-init.d] 01-confd-render-templates.sh: executing...
idc-solr-1 | Waiting for up to 0 seconds to connect to etcd:2379
idc-solr-1 | confd using 'env' backend...
idc-solr-1 | 2022-09-12T14:04:31Z 2b4ce749bb00 confd[201]: INFO Backend set to env
idc-solr-1 | 2022-09-12T14:04:31Z 2b4ce749bb00 confd[201]: INFO Starting confd
@DonRichards
DonRichards / context.context.collection.yml
Created July 19, 2022 20:06
example collections context
uuid: d57b6db6-587f-4c9b-9f4c-e89246cf28fe
langcode: en
status: true
dependencies:
config:
- views.view.solr_search_content
module:
- islandora
- views
label: Collection
@DonRichards
DonRichards / isle-dc_debug_info.sh
Last active June 23, 2022 15:00
isle-dc debug info
#!/usr/bin/env bash
# To run this script
# bash <(curl -sL https://gist.githubusercontent.com/DonRichards/f23d333517db7a8da09df2a5641b36ec/raw/isle-dc_debug_info.sh) | tee output.txt
echo -e "\n\n--------- --------- ---------"
CURRENT_DIRECTORY_NAME=$(basename "$PWD")
# Check if the current directory contains isle-dc in the name
if [[ $CURRENT_DIRECTORY_NAME == *"isle-dc"* ]]; then
@DonRichards
DonRichards / README.md
Last active July 17, 2024 16:18 — forked from seth-shaw-unlv/generate-image-derivatives.php
Islandora script for triggering new derivatives (tested on isle-dc and production)

This script adds the ability to use drush to generate missing derivatives. This looks for nodes without a service file (the hint that a derivative wasn't generated) and triggers the derivative actions.

Note: that drush commands that trigger actions should also specify the site url. E.g. drush -l https://islandora.traefik.me scr /var/www/drupal/vendor/drush/drush/src/Utils/generate-image-derivatives.php. Otherwise the messages alpaca receives includes paths like "default/node//media/add/" and it doesn't know what to do with that. I should have mentioned that before.

How to run this script

Super Fast method to run