Skip to content

Instantly share code, notes, and snippets.

@rosiel
rosiel / mods_to_dc_fixed.xsl
Last active December 15, 2015 10:39
Actually handles dates with no @point attributes.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mods="http://www.loc.gov/mods/v3" exclude-result-prefixes="mods"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:srw_dc="info:srw/schema/1/dc-schema"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
This stylesheet transforms MODS version 3.2 records and collections of records to simple Dublin Core (DC) records,
#!/bin/bash
# Mac-compatible script
# Writes the contents of an unprotected DVD to an MPEG-2 file in the current directory.
# Temporarily set the for-loop delimiter to deal with filenames with spaces.
# Source: http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
@rosiel
rosiel / cloudy.py
Created September 7, 2017 15:44
Hypothesis: it's more likely to be cloudy given that yesterday was cloudy, than that the day before yesterday was cloudy.
#!/usr/local/bin/python3
import csv
dates = []
cloudyvalues = []
pattern = []
pattern3 = []
thisdate = '11-5-2005'
thissky = []
@rosiel
rosiel / Spouse Relationship With Qualifiers.md
Last active September 20, 2017 16:12
Analysis of a Wikidata Statement

How Wikidata uses Reification to Qualify an RDF statement

The Buffy Sainte-Marie wikidata page[1] shows a qualified spousal relationship. In English,

Buffy Sainte Marie has Spouse Jack Nitzsche with start time: 19 March 1982 and end time: 25 August 2000

[1] https://www.wikidata.org/wiki/Q467027

@rosiel
rosiel / vagrant-clean.sh
Created October 23, 2017 21:25 — forked from DiegoPino/vagrant-clean.sh
Script to clean up Ubuntu Vagrant box before packaging
#!/bin/bash
# This script zeroes out any space not needed for packaging a new Ubuntu Vagrant base box.
# Run the following command in a root shell:
#
# bash <(curl -s https://gist.github.com/justindowning/5670884/raw/vagrant-clean.sh)
function print_green {
echo -e "\e[32m${1}\e[0m"
}
@rosiel
rosiel / package-vagrant-box.md
Last active May 15, 2018 13:29 — forked from DiegoPino/package-vagrant-box.md
How to create an Islandora VM

Creating a VM (.ova) from a vagrant box

  1. Get an up-to-date clone of Islandora Vagrant.
  2. Shut off all VMs, and destroy any existing VMs with the same name.
  3. vagrant up (and wait for the base box to load up)
  4. Log into Drupal and change the site name.
  5. Change the colours of the branding too, if appropriate.
  6. Clean up disk space. We just did a lot of apt-get so its cache is full.
$ sudo apt-get clean
@rosiel
rosiel / xpath-mods-title
Last active March 28, 2018 17:31
XPATH snippet to extract MODS title and apply ISBD punctuation
string-join(
(
string-join(
(
string-join(
(
/mods/titleInfo[not(@type)]/nonSort/text(),
/mods/titleInfo[not(@type)]/title/text()
),
' '
@rosiel
rosiel / Modularization Update 2022-09-27.md
Last active September 27, 2022 15:43
Update on the Modularization project for Islandora Open Meeting 2022-09-27

Islandora Modularization Project (IMP) Update, Sept 27 2022

From the Contract between DGI and the IF:

The intended benefit is to make Islandora smaller and easier to install, increase flexibility of features (including optional scaling), increase the spread of modules with the broader Drupal community and thereby get more interest and help in modules maintenance, simplify testing and maintenance, simplify dependencies, and improve feature definition and documentation.

The IF agreed for DGI to work on two elements from the "Phase 1" of the modularization project. These are:

  • Change Defaults to a Starter Site (nearly completed)
  • Scope out the work in Phase 2.
@rosiel
rosiel / recipe.md
Last active March 15, 2023 14:27
advanced search instructions

Use Advanced Search and Collection search

written for release 0.4.0 of the Islandora Starter Site.

Which version to use

  • Use UTSC's version, at https://github.com/digitalutsc/advanced_search. It has the advanced features that are described here (particularly Extended Dismax, up-to-date AJAX handling, and Keyword (all-fields) search). Get it with Composer (you'll have to define your own repository) as composer require islandora/advanced_search:dev-contrib and enable it with Drush.
  • If you're using Islandora's Advanced Search, uninstall it.

Set up Advanced Search

@rosiel
rosiel / 1-export config.yml
Last active March 28, 2024 17:31
move-publisher-to-own-field.py
task: get_data_from_view # See Z-View to export
host: "http://islandora.dev"
view_path: '/nodes-for-publisher'
username: admin
password: password
content_type: islandora_object
export_csv_file_path: ./islandora_export.csv
# If export_csv_field_list is not present, all fields will be exported.
# node_id and title are always included.
export_csv_field_list: ['field_linked_agent', 'field_publisher']