Skip to content

Instantly share code, notes, and snippets.

View rosy1280's full-sized avatar

Rosalyn Metz rosy1280

View GitHub Profile
#!/bin/bash
#
###############################
# get the hostname from ec2 #
###############################
HOST=`ec2-get-info --public-hostname | cut -d":" -f2`
#
###############################
# echo the hostname out #
###############################
@rosy1280
rosy1280 / startup-moodle.sh
Last active September 5, 2015 15:45
start up script for moodle
#!/bin/bash
#
# start up script for moodle
#
###############################
# Define the Variables
###############################
CURRENT_URL="example.com/moodle"
NEW_URL=`wget -q -O - http://169.254.169.254/latest/meta-data/public-hostname`
@rosy1280
rosy1280 / set-step-status-console.rb
Last active August 29, 2015 14:10
set group of druids to a particular status via console
druids = ["druid:bt238kw3938", "druid:bw690ww9101", "druid:cc502yd9847", "druid:ch100bz7050"]
druids.each do |druid|
begin
@object=Dor::Item.find(druid)
Dor::WorkflowService.update_workflow_status 'dor', @object.pid, 'accessionWF', 'provenance-metadata', 'waiting'
end
end
@rosy1280
rosy1280 / bulk-close-versions-console.rb
Last active August 29, 2015 14:10
bulk close versions via console
druids = ["druid:bt238kw3938", "druid:bw690ww9101", "druid:cc502yd9847", "druid:ch100bz7050"]
druids.each do |druid|
begin
@object=Dor::Item.find(druid)
# for some reason this doesn't seem to work. no idea why...
#Dor::WorkflowService.close_version 'dor', @object.pid, {:description=>'apply apo defaults', :significance=>:minor}
# so instead I'll do the following
@object.versionMetadata.update_current_version({:description=>'apply apo defaults', :significance=>:minor})
@object.save
Dor::WorkflowService.close_version 'dor', @object.pid
@rosy1280
rosy1280 / bulkCloseScript.rb
Last active August 29, 2015 14:10
bulk close version via a script
#!/usr/bin/env ruby
# usage is ruby bulkCloseScript.rb env druid-list.txt
# where env is the environment in which you want to run the script (production, test, development)
# and druid-list.txt is the list of druids you want to bulk close.
unless(ARGV.first.nil?)
ENV['ROBOT_ENVIRONMENT'] = ARGV.first
end
require File.expand_path(File.dirname(__FILE__) + '/../config/boot')
@rosy1280
rosy1280 / bulkGetTagsScript.rb
Last active August 29, 2015 14:11
get all the tags for a list of objects
#!/usr/bin/env ruby
# usage is ruby bulkGetTagsScript.rb env druid-list.txt
# where env is the environment in which you want to run the script (production, test, development)
# and druid-list.txt is the list of druids you want to bulk close.
unless(ARGV.first.nil?)
ENV['ROBOT_ENVIRONMENT'] = ARGV.first
end
require File.expand_path(File.dirname(__FILE__) + '/../config/boot')
@rosy1280
rosy1280 / addTagScript.rb
Last active January 16, 2016 00:02
add new tag to a list of objects
#!/usr/bin/env ruby
# script should be placed in the common-accessioning/current/bin directory
# usage is ruby addTagScript.rb {env} druid-list.txt
# where {env} is the environment in which you want to run the script (production, test, development)
# and druid-list.txt is the list of druids you want to add tags to.
# NOTE: you need to change the tag, right now its set to add 'Project : Chinese Topographic Maps'
unless(ARGV.first.nil?)
ENV['ROBOT_ENVIRONMENT'] = ARGV.first
end
{
"@context": "https://ocfl.org/v1.0/",
"id": "urn:ark:12148/btv1b84490444",
"type": "Object",
"head": "#v3",
// This is a list of all files that are in the object. It must be updated
// with files added in new versions.
// Writing the same file to a new location (same checksum, different path)
// is an error, since versions are fixed and cannot be changed. Instead,
// if a file is restored in later versions, it can be referenced in its earlier