Skip to content

Instantly share code, notes, and snippets.

View dheles's full-sized avatar

Drew Heles dheles

  • LYRASIS
  • Baltimore, MD
View GitHub Profile
@dheles
dheles / stats.py
Created February 16, 2022 15:47
Python script for calculating Islandora storage usage
#!/usr/bin/env python3
# written by https://github.com/jonathangreen & shared with his permission
# modest aditional contributions by https://github.com/dheles
import argparse
import os
import lxml.etree as ET
from multiprocessing import Pool
from datetime import datetime
@dheles
dheles / sqlite_example_2.py
Last active June 6, 2019 13:42
example python script for inserting values into a single-column sqlite db
#!/usr/bin/env python
import sqlite3
def main():
conn = sqlite3.connect('example.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE example
@dheles
dheles / sqlite_example.py
Created June 5, 2019 20:38
example python script inserting into a sqlite db
#!/usr/bin/env python
import sqlite3
def main():
conn = sqlite3.connect('example.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE example
@dheles
dheles / server.log
Last active April 16, 2019 13:40
dataverse (v4.12) indexing error log
[#|2019-04-12T16:59:51.484+0000|INFO|glassfish 4.1|edu.harvard.iq.dataverse.search.IndexBatchServiceBean|_ThreadID=125;_ThreadName=__ejb-thread-pool1;_TimeMillis=1555088391484;_LevelValue=800;|
indexing dataset 1 of 68 (id=16)|#]
[#|2019-04-12T16:59:51.672+0000|WARNING|glassfish 4.1|javax.enterprise.ejb.container|_ThreadID=125;_ThreadName=__ejb-thread-pool1;_TimeMillis=1555088391672;_LevelValue=900;_MessageID=AS-EJB-00056;|
A system exception occurred during an invocation on EJB DataverseServiceBean, method: public edu.harvard.iq.dataverse.Dataverse edu.harvard.iq.dataverse.DataverseServiceBean.findRootDataverse()|#]
[#|2019-04-12T16:59:51.672+0000|WARNING|glassfish 4.1|javax.enterprise.ejb.container|_ThreadID=125;_ThreadName=__ejb-thread-pool1;_TimeMillis=1555088391672;_LevelValue=900;|
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean
at com.sun.ejb.containers.EJBContainerTransactionManager.checkExceptionClientTx(EJBContainerTransactionManager.java:662)
at com.sun.ejb.conta
#---------------------------------------------------------------#
#----------------SWORD 2.0 SERVER CONFIGURATIONS----------------#
#---------------------------------------------------------------#
# These configs are only used by the SWORD Server interface, #
# version 2.0 (used by DSpace to accept ingest packages via #
# SWORD 2.0 protocol) #
#---------------------------------------------------------------#
# the base url of the sword 2.0 system
#
# EXAMPLE "local.cfg" for DSpace.
#
# Any configurations added to this file will automatically OVERRIDE configurations
# of the same name in any of the DSpace *.cfg files. This includes overriding
# settings in any of these files:
# * [dspace]/config/dspace.cfg
# * Or any configuration file that is included in 'dspace.cfg'
# (See "include = [filepath]" settings near the end of dspace.cfg.
# By default, it includes all [dspace]/config/modules/*.cfg files)
#
$ python client.py
https://jscholarship.library.jhu.edu/swordv2/collection/1774.2/58586
atom_generator: '['admin@dspace-prod.mse.jhu.edu version:"2.0" uri:"http://www.dspace.org/ns/sword/2.0/"']'
atom_id: '['https://jscholarship.library.jhu.edu/swordv2/edit/dbbde8a5-179f-4e94-bd4f-c852682e357d']'
atom_rights: '[None]'
atom_title: '['Untitled: example.zip']'
atom_updated: '['2018-07-02T04:00:00.000Z']'
dcterms_available: '['2018-07-02T16:48:49Z']'
dcterms_description: '['Zip file deposted by SWORD without accompanying metadata']'
dcterms_provenance: '['Made available in DSpace on 2018-07-02T16:48:49Z (GMT). No. of bitstreams: 2\nexample.zip: 33777 bytes, checksum: 2b25f82ba67284461d4a481d7a06dd28 (MD5)\nexample.zip: 33777 bytes, checksum: 2b25f82ba67284461d4a481d7a06dd28 (MD5)']'
@dheles
dheles / test_login.rb
Created November 4, 2017 13:53
regex format example
def test_session
session = "test-session"
default_label = "test-default-login"
session_label = "test-session-login"
username = "user"
password = "pass"
default_output = "#{default_label}:#{username}:#{password}"
session_output = "#{session_label}:#{username}:#{password}"
error_pattern_no_record = /No such record\(s\)/
error_pattern_no_session = /Unknown session/
@dheles
dheles / gem_build_hyrax_gemspec.log
Created July 18, 2017 17:02
output from building hyrax 1.0.3 gem
$ gem build hyrax.gemspec
WARNING: license value 'Apache2' is invalid. Use a license identifier from
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
Did you mean 'Apache-2.0', 'mpich2'?
WARNING: open-ended dependency on hydra-head (>= 10.4.0) is not recommended
if hydra-head is semantically versioned, use:
add_runtime_dependency 'hydra-head', '~> 10.4', '>= 10.4.0'
WARNING: open-ended dependency on browse-everything (>= 0.10.5) is not recommended
if browse-everything is semantically versioned, use:
add_runtime_dependency 'browse-everything', '~> 0.10', '>= 0.10.5'
@dheles
dheles / dspace_packager.rake
Created May 17, 2017 16:28
dspace packager rakefile
# Author: Aaron Collier, CalState
# Adapted for JHU by Drew Heles
# Steps to use this:
# 1 - Export DSpace data in AIP format
# ---- [dspace bin]/dspace packager -d -a -e [email address] -i [handle of comm/coll/item] -t AIP [full path to export file name in .zip format]
# ---- this will include all sub items and collections in ITEM-HANDLE.zip format - move all files to server for import
# 2 - in the directory with the above zip files, add a "complete" directory (this should be added to the code, just hasn't been done yet)
# 3 - run the rake from your hydra project root as: rake packager:aip["path/to/top_level_zip","admin@somehere.edu"] (where admin@ is your admin email address)