Skip to content

Instantly share code, notes, and snippets.

View alanorth's full-sized avatar

Alan Orth alanorth

View GitHub Profile
@alanorth
alanorth / curation.log
Created April 23, 2024 12:49
Log of curations during workflow submission, step 2 (editor), and step 3 (final editor)
2024-04-23 12:44:00,166 INFO e8f31038-977a-41d3-9ce3-c8f213c12691 7eca3e82-151a-421a-bda6-b2071df437b3 org.dspace.curate.Curator @ Curation task: normalizedois performed on: workflow item: 61ad243b-18a2-4691-a4e0-f90eb6b42ece with status: 0. Result: 'Normalized 1 DOI(s)'
2024-04-23 12:44:00,167 INFO e8f31038-977a-41d3-9ce3-c8f213c12691 7eca3e82-151a-421a-bda6-b2071df437b3 org.dspace.curate.XmlWorkflowCuratorServiceImpl @ Curation tasks over item 61ad243b-18a2-4691-a4e0-f90eb6b42ece for step editstep report:%nNormalized 1 DOI(s)All DOIs already normalizedAll DOIs already normalizedAll DOIs already normalizednull: added 2 alpha2 country code(s)Normalized 1 DOI(s)
2024-04-23 12:46:28,096 INFO e8f31038-977a-41d3-9ce3-c8f213c12691 8b975b71-6f76-4ac3-b5c7-52aa4cdd1e3f org.dspace.curate.Curator @ Curation task: normalizedois performed on: workflow item: 61ad243b-18a2-4691-a4e0-f90eb6b42ece with status: 0. Result: 'All DOIs already normalized'
2024-04-23 12:46:28,096 INFO e8f31038-977a-41d3-9ce3-c8f213c12691 8b97
@alanorth
alanorth / pre-process-media.sh
Last active February 23, 2024 16:24
Script for preparing media files for long-term archival
#!/usr/bin/env bash
#
# pre-process-media.sh v2021-12-26
#
# Prepare a directory of images and videos for long-term archival by normalizing
# their names, optimizing JPEGs with jpeg-archive, and stripping embedded MP4s
# from Android Motion Photos.
#
# SPDX-License-Identifier: GPL-3.0-only
@alanorth
alanorth / gdal-centos7.md
Last active February 2, 2024 01:42
Install GDAL 2.4.2 on CentOS 7

Install Proj

GDAL needs Proj:

$ cd /tmp
$ wget https://download.osgeo.org/proj/proj-6.1.1.tar.gz
$ tar xf proj-6.1.1.tar.gz 
$ cd proj-6.1.1
$ ./configure --prefix=/export/apps/proj/6.1.1
$ make -j4
#!/usr/bin/env bash
# run in batch CPU priority, with low-priority IO
rsync_command="chrt -b 0 ionice -c2 -n7 /usr/bin/rsync -av --delete"
rsync_output="start"
until [[ "$rsync_output" == "done" ]]
do
# notice the trailing slash on the rsync source argument
results_rsync=$($rsync_command /home/dspace/solr/ /home/backup/solr)
@alanorth
alanorth / dspace6-post-item-rest.md
Last active November 27, 2023 18:08
POSTing items to the DSpace 6 REST API

POSTing an item to /collections

First log in to get the JSESSIONID cookie and then post the item (I'm using httpie instead of curl):

$ http -f POST https://dspacetest.cgiar.org/rest/login email=aorth@mjanja.ch password=fuuuu
$ http https://dspacetest.cgiar.org/rest/status Cookie:JSESSIONID=EABAC9EFF942028AA52DFDA16DBCAFDE
$ http POST https://dspacetest.cgiar.org/rest/collections/f10ad667-2746-4705-8b16-4439abe61d22/items Cookie:JSESSIONID=EABAC9EFF942028AA52DFDA16DBCAFDE < item-object.json
HTTP/1.1 200 OK
Connection: keep-alive
Content-Encoding: gzip
@alanorth
alanorth / geojson-test.py
Created March 6, 2023 12:37
Checking if GPS points are in a polygon with Shapely
#!/usr/bin/env python
#
# Given the three points below, this code prints:
#
# $ ~/src/geojson-test.py
# True
# True
# False
#
# Requires shapely to be installed in the virtual environment.
@alanorth
alanorth / solr.service
Created November 24, 2023 09:05
systemd unit for solr
[Unit]
Description=Solr 8.11.2
After=network.target
[Service]
Type=simple
WorkingDirectory=/var/solr
PIDFile=/var/solr/solr-8983.pid
Environment=SOLR_PID_DIR=/var/solr
@alanorth
alanorth / dspaces.csv
Last active October 4, 2023 16:39
List of DSpace 7 instances to serve as inspiration for those of us who have not yet managed to take the plunge
version url
7.0 https://repository.museumsiam.org
7.0 https://minerva-access.unimelb.edu.au
7.0 https://unsworks.unsw.edu.au
7.4 https://corpus.ulaval.ca
7.5-SNAPSHOT https://dspace.alquds.edu
7.5 https://openaccess.marmara.edu.tr
7.2.1 https://oasis.col.org
7.2.1 https://open.fsc.org
7.4 https://openaccess.bezmialem.edu.tr
@alanorth
alanorth / direct-query-views.py
Last active October 2, 2023 22:04
Direct Solr query for items in a specific date range
#!/usr/bin/env python3
import re
import requests
# Enumerate the cores in Solr to determine if statistics have been sharded into
# yearly shards by DSpace's stats-util or not (for example: statistics-2018).
def get_statistics_shards():
@alanorth
alanorth / authentication-ldap.cfg
Created September 28, 2023 05:49
DSpace 7 authentication-ldap.cfg
#---------------------------------------------------------------#
#------------LDAP AUTHENTICATION CONFIGURATIONS-----------------#
#---------------------------------------------------------------#
# Configuration properties used by the LDAP Authentication #
# plugin, when it is enabled. #
#---------------------------------------------------------------#
#
# If LDAP is enabled, then new users will be able to register
# by entering their username and password without being sent the