Skip to content

Instantly share code, notes, and snippets.

View DonRichards's full-sized avatar

Don Richards DonRichards

  • Johns Hopkins University
  • Knoxville, TN
  • 05:30 (UTC -04:00)
  • X @highlander411
View GitHub Profile
@DonRichards
DonRichards / Islandora Drupal Engineer ChatGPT Prompt
Last active November 5, 2024 14:35
Islandora Drupal Engineer ChatGPT
**Islandora Drupal Engineer GPT Instructions**
You are a 'GPT' – a version of ChatGPT customized to assist with Drupal software engineering, specializing in Islandora development. You provide expert guidance on development, setup, and maintenance related to Islandora, Drupal, and the Fedora Commons Repository. You also help users resolve issues and answer questions related to Islandora Workbench. Your role includes handling database queries, code debugging, and offering advice on module development and configuration.
You have access to several reference files that are essential to your task. You will dynamically use these files to ensure accurate and detailed answers to all user queries.
### **Files Available for Reference**
- **Islandora_Drupal_Engineer_Prompt.md**: This file contains tips, tricks, and best practices for Islandora development. Use it for advanced troubleshooting, module setup, and system optimization. When questions regarding the Islandora namespace change to drupal arise, refer users to
@DonRichards
DonRichards / README.md
Last active August 20, 2024 12:30
Islandora Isle-DC Service Discovery and Network Check Troubleshooting Script

Islandora Isle-DC Service Discovery and Network Check Script (DRAFT)

This script is designed to verify the network configuration and DNS resolution of services running in Docker containers specifically within an Islandora Isle-DC environment. It helps ensure that all microservices and components in the Isle-DC stack are correctly connected and communicating.

Features

  • Service Discovery: Automatically identifies services defined in your docker-compose.yml file for Isle-DC.
  • Network Validation: Checks if each Isle-DC service is connected to the correct Docker network.
  • Ping Tests: Performs ping tests between all running Isle-DC services to verify inter-container communication.
  • DNS Resolution: Ensures that DNS is properly configured and resolves between services in the Isle-DC environment.
@DonRichards
DonRichards / server_specs_and_performance.sh
Created July 23, 2024 14:35
Summary of a server's hardware specifications and performance metrics
#!/bin/bash
# Description:
# server_specs_and_performance.sh is a comprehensive shell script designed to provide an easy-to-read
# summary of a server's hardware specifications and performance metrics. Specifically, the script:
#
# 1. Benchmarks CPU and I/O performance:
# - Runs `vmstat` every 5 seconds for 1 minute to collect performance metrics.
# - Analyzes metrics such as `r`, `us`, `sy`, `id`, `wa`, `bi`, and `bo` to determine if there are
# potential issues with CPU or disk I/O performance.
@DonRichards
DonRichards / README.md
Created July 17, 2024 14:21
Super Res Down size image to use for Thumbnails

This make the image super clear and reduces the size to a width of 1024

Modified Real-ESRGAN/inference_realesrgan.py: Made changes to enhance debugging but might not be needed.

Incomplete bash history

pipenv shell
git clone https://github.com/xinntao/Real-ESRGAN.git
cd Real-ESRGAN
@DonRichards
DonRichards / hashes_merge_aws_logs.py
Created July 2, 2024 14:19
Processes multiple JSON files provided by S3 when copying a bucket and extract and display unique `RelativePath` and `SrcChecksum` pairs.
import os
import json
import pandas as pd
"""
This script processes multiple JSON files to extract and display unique `RelativePath` and `SrcChecksum` pairs.
1. Loads JSON files from a specified directory.
2. Extracts `RelativePath` and `SrcChecksum` from the `Verified` list in each JSON file.
3. Tracks unique `RelativePath` and their corresponding `SrcChecksum` to avoid duplicates.
4. Identifies and logs instances where the same `RelativePath` has different `SrcChecksum` values.
@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 / 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"