Skip to content

Instantly share code, notes, and snippets.

{
"last_updated_at": "2025-05-13 17:33:58 UTC",
"manifests": [
"https://raw.githubusercontent.com/collectionspace/cspace-config-untangler/refs/heads/main/data/mapper_manifests/community_profile_mappers_release_8_1_1_newstyle.json"
]
}
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('TABLE_NAME')
def update_items(items):
for item in items:
table.update_item(
Key={
@mark-cooper
mark-cooper / index.html
Created May 7, 2022 05:55
CSpace Public Browser example
<!DOCTYPE html>
<html>
<!-- cspace public browser tester -->
<!-- python3 -m http.server [8000] -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CollectionSpace Public Browser</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css">
@mark-cooper
mark-cooper / .env.asdev
Created April 28, 2022 00:41
Experiment with scripts for running dev servers directly using jruby.
# cfg gems etc.
export ASPACE_ENV=development
export CLASSPATH=$PWD/build/gems/jruby/2.5.0:$PWD/common:$PWD/common/lib/*
export GEM_HOME=$PWD/build/gems/jruby/2.5.0
export GEM_PATH=$PWD/build/gems:$GEM_HOME
# cfg urls
export APPCONFIG_BACKEND_URL="http://localhost:4567"
export APPCONFIG_DB_URL="jdbc:mysql://127.0.0.1:3306/archivesspace?useUnicode=true&characterEncoding=UTF-8&user=as&password=as123&useSSL=false&allowPublicKeyRetrieval=true"
export APPCONFIG_FRONTEND_URL="http://localhost:3000"
@mark-cooper
mark-cooper / ascli
Last active November 5, 2024 00:35
Load ArchivesSpace backend in a pry session
#!/bin/bash
# SETUP: requires rbenv
# rbenv install jruby-9.4.8.0 && rbenv local jruby-9.4.8.0 && gem install bundler pry
# docker-compose -f docker-compose-dev.yml build
# docker-compose -f docker-compose-dev.yml up --detach
# ./build/run bootstrap && ./build/run db:migrate
# chmod u+x ./ascli
# ./ascli
export ASCLI_RUNNER=${1:-rbenv}

Upgrading Rack for ArchivesSpace

  • Install local JRuby (match aspace version, currently: 9.2.12.0) and switch to it.
  • Install Maven.
  • Download jruby-rack.
git checkout 1.1-stable
# install bundler version to match 1.1-stable Gemfile.lock
gem install bundler --version=1.14.6
@mark-cooper
mark-cooper / exports.py
Last active July 18, 2018 23:02
ArchivesSpace: basic script to download exported files to `exports` folder in current directory.
#!/usr/bin/env python3
'''
Basic script to download exported files to `exports` folder in current
directory. It will only download if a file does not exist or the remote
file is updated and "newer" than an existing local file. A remote file
with deleted status will be removed if it exists in the local directory.
SETUP:
python3 required [adjust python3 and pip3 refs per system setup]
@mark-cooper
mark-cooper / check_archon_classifications.rb
Created March 22, 2017 18:34
Check Archon returns all classifications
require 'httparty'
require 'json'
require 'set'
def ok_status?(code)
code.to_s =~ /^2/
end
BASE_URL ="http://localhost/"
$batch_start = 1
DELIMITER //
CREATE FUNCTION generateLocationTitle(_id INT)
RETURNS TEXT
READS SQL DATA
BEGIN
DECLARE _title VARCHAR(255) DEFAULT '';
SELECT
REPLACE(
CONCAT(
@mark-cooper
mark-cooper / TOP_CONTAINER_MIGRATION.md
Last active June 3, 2016 05:56
Top container migration -- what happens?

Top container migration

Reminder: regarding top containers you may have an issue if you don't use barcodes and do reuse numbering sequences within the same resource or accession. Otherwise, review the upgrade documentation and relax =)

What happens during the top container migration? Example (fairly) typical tree with parallel sequencing (reused box numbering sequences):

Record 1
-