Skip to content

Instantly share code, notes, and snippets.

View cjcolvar's full-sized avatar

Chris Colvard cjcolvar

  • Bloomington, IN
View GitHub Profile
@cjcolvar
cjcolvar / gist:7415481
Last active December 28, 2015 00:39
Bash script for creating avalon OVA
#!/bin/bash
vagrant up
VM_UUID=`VBoxManage list runningvms | grep -o '[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}'`
HD_UUID=`VBoxManage list -l runningvms | grep "SATA.*UUID" | grep -o '[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}'`
vagrant halt
VM_DATE=`date +%y%m%d`
VBoxManage modifyhd ${HD_UUID} --compact
VBoxManage export ${VM_UUID} --output avalon-vm-${VM_DATE}.ova --product "Avalon Media System" --producturl http://www.avalonmediasystem.org --version R2
@cjcolvar
cjcolvar / buildOVA.sh
Last active December 28, 2015 08:19
Bash script to build an OVA after vagrant up
#!/bin/bash
vagrant destroy
vagrant up
VM_UUID=`VBoxManage list runningvms | grep -o '[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}'`
HD_UUID=`VBoxManage list -l runningvms | grep "SATA.*UUID" | grep -o '[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}'`
VM_DATE=`date +%y%m%d`
VBoxManage snapshot "${VM_UUID}" take "avalon-vm-${VM_DATE}-bootstrapped"
#Do OVA prep
vagrant ssh -c 'sudo yum install -y NetworkManager-gnome firstboot perl-XML-Twig perl-YAML-LibYAML'
vagrant ssh -c 'sudo rpm -i "http://www.avalonmediasystem.org/downloads/avalon-vm-2.0-1.noarch.rpm"'
@cjcolvar
cjcolvar / gist:7479811
Created November 15, 2013 05:58
Commands I used to zero out space on a virtual disk from the host without running the guest vm
#Magic to zero out space on host without running guest
modprobe nbd max_part=16
qemu-nbd -c /dev/nbd0 /home/cjcolvar/VirtualBox\ VMs/avalon-installer_default_1383930303/box-disk1.vdi
partprobe
vgchange -a y VolGroup
zerofree /dev/mapper/VolGroup-lv_swap
zerofree /dev/mapper/VolGroup-lv_root
vgchange -a n VolGroup
qemu-nbd -d /dev/nbd0
#End magic
@cjcolvar
cjcolvar / gist:1d821fe502016aceea1b
Last active August 29, 2015 14:07
Blacklight actions
#Adding a new document action:
#Override the catalog controller or subclass and add your action:
#needs user feedback from a form
self.add_action(:translate, :translate_action, validator: :validate_translate_params)
def translate_action
Translator.translate(documents, params[:language])
end
#doesn't require form feedback
@cjcolvar
cjcolvar / gist:a7ead7472e9ffd6673f1
Created August 3, 2015 16:16
Matterhorn distribute-hls stacktrace
2015-07-28 17:45:16 INFO (AbstractCmdlineEncoderEngine:237) - Executing encoding command: /usr/bin/ffmpeg -i /usr/local/matterhorn/work/opencast/workspace/mediapackage/8677661e-0e40-4585-a94d-6ae8c4af664d/bf058e85-3770-4607-b10e-82b09f4c7bec/filename.mp4 -codec copy -map 0 -bsf h264_mp4toannexb -f segment -segment_list /usr/local/matterhorn/work/opencast/workspace/mediapackage/8677661e-0e40-4585-a94d-6ae8c4af664d/bf058e85-3770-4607-b10e-82b09f4c7bec/filename_b20051ba-dc9c-409b-b62d-6ad46e068dce.m3u8 -segment_time 10 /usr/local/matterhorn/work/opencast/workspace/mediapackage/8677661e-0e40-4585-a94d-6ae8c4af664d/bf058e85-3770-4607-b10e-82b09f4c7bec/filename_b20051ba-dc9c-409b-b62d-6ad46e068dce-%03d.ts
2015-07-28 17:45:16 INFO (AbstractCmdlineEncoderEngine:261) - Video track filename.mp4 successfully encoded using profile 'profile.hls.http'
2015-07-28 17:45:16 WARN (HLSDistributionServiceImpl:269) - Error distributing http://avalon.example.com:18080/files/mediapackage/8677661e-0e40-4585-a94d-6ae8c4af664d/d48e
@cjcolvar
cjcolvar / example.vtt
Created March 9, 2016 15:41
Example vtt file for testing
WEBVTT
1
00:00:01.000 --> 00:00:10.000
This is the first line of text, displaying from 1-10 seconds
2
00:00:15.000 --> 00:00:20.000
And the second line of text
separated over two lines
@cjcolvar
cjcolvar / gist:b56aa87848d6cc519a3f7c36cd24db56
Created June 23, 2016 15:22
Options for determining what migrations need to be run
[cjcolvar@localhost avalon]$ bundle exec rake db:version
Current version: 20160511155417
[cjcolvar@localhost avalon]$ bundle exec rake db:migrate:status
database: /home/cjcolvar/Code/avalon/avalon/db/development.sqlite3
Status Migration ID Migration Name
--------------------------------------------------
up 20120202180525 Devise create users
up 20120202180540 Create searches
@cjcolvar
cjcolvar / .fcrepo_wrapper
Created May 19, 2017 17:12
fcrepo_wrapper config that enables jmx
# Place any default configuration for solr_wrapper here
port: 8984
enable_jms: false
fcrepo_home_dir: tmp/fcrepo4-development-data
java_options:
- '-Dfcrepo.log.http.api=WARN'
- '-Dfcrepo.log.kernel=ERROR'
- '-Dfcrepo.home=tmp/fcrepo4-development-data'
- '-Dfcrepo.spring.jms.configuration=file:///Users/cjcolvar/.rvm/gems/ruby-2.3.1/gems/fcrepo_wrapper-0.7.0/data/spring-noop.xml'
- '-Dcom.sun.management.jmxremote'
@cjcolvar
cjcolvar / gist:1ca9326120e99ab1bddde0f66c4877fc
Created July 31, 2017 18:13
DescendentFetcher which partitions into model names passed, skips PairTree nodes, and stops after first level of non-PairTree nodes
module ActiveFedora
module Indexing
# Finds all descendent URIs of a given repo URI (usually the base URI).
#
# This is a slow and non-performant thing to do, we need to fetch every single
# object from the repo.
#
# The DescendantFetcher is also capable of partitioning the URIs into "priority" URIs
# that will be first in the returned list. These prioritized URIs belong to objects
# with certain hasModel models. This feature is used in some hydra apps that need to
@cjcolvar
cjcolvar / gist:a7c26de736e5dede6381ea6b31264a16
Created November 2, 2017 19:35
Variations migration script via batch ingest from Paul Hoffman
#!/usr/bin/perl
use strict;
use warnings;
use XML::LibXSLT;
use XML::LibXML;
use POSIX qw(strftime);
use File::Basename qw(dirname basename);
use Getopt::Long