Skip to content

Instantly share code, notes, and snippets.

cjcolvar

Block or report user

Report or block cjcolvar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cjcolvar
cjcolvar / gist:7479811
Created Nov 15, 2013
Commands I used to zero out space on a virtual disk from the host without running the guest vm
View gist:7479811
#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 / buildOVA.sh
Last active Dec 28, 2015
Bash script to build an OVA after vagrant up
View buildOVA.sh
#!/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:7415481
Last active Dec 28, 2015
Bash script for creating avalon OVA
View gist:7415481
#!/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 / cleanupExportedAvalonObject.rb
Created Oct 31, 2013
A script which will clean up an exported avalon fedora object to prepare it to become a fixture
View cleanupExportedAvalonObject.rb
require 'nokogiri'
require 'open-uri'
require 'base64'
filename = ARGV[0]
f = File.new filename
doc = Nokogiri::XML::Document.parse f
f.close
#Get rid of Audit trail
doc.xpath("//foxml:datastream[@ID='AUDIT']").each {|n| n.remove()}
@cjcolvar
cjcolvar / stripChaptersCronJob.sh
Last active Dec 26, 2015
Cronjob script for finding mp4 files in a directory then exporting and stripping chapters for compatibility with Adobe Media Server
View stripChaptersCronJob.sh
#!/bin/bash
lockdir=~/
searchdir=$1
if [ -e ${lockdir}/.stripChaptersCronJob.lock ]
then
exit
fi
touch ${lockdir}/.stripChaptersCronJob.lock
@cjcolvar
cjcolvar / gist:6813926
Created Oct 3, 2013
hydra-role-management routes change to allow mounting at custom path
View gist:6813926
Hydra::RoleManagement::Engine.routes.draw do
#role_users POST /roles/:role_id/users(.:format) user_roles#create
# role_user DELETE /roles/:role_id/users/:id(.:format) user_roles#destroy
# roles GET /roles(.:format) roles#index
# POST /roles(.:format) roles#create
# new_role GET /roles/new(.:format) roles#new
# edit_role GET /roles/:id/edit(.:format) roles#edit
# role GET /roles/:id(.:format) roles#show
# PUT /roles/:id(.:format) roles#update
View gist:6640436
cap deploy matterhorn HOSTS=pawpaw.dlib.indiana.edu production SCM_BRANCH=release/2.0.0
@cjcolvar
cjcolvar / fedora_solr_sync_issues_spec.rb
Last active Dec 23, 2015
Avalon test that should work, but leads to infinite loop resulting in tons of requests to solr and fedora and eventually times out.
View fedora_solr_sync_issues_spec.rb
require 'spec_helper'
describe 'fedora_solr_sync_issues' do
describe 'master files no longer in fedora but still in solr' do
let!(:master_file) {FactoryGirl.create(:master_file)}
after do
ActiveFedora::SolrService.instance.conn.delete_by_id(master_file.pid)
ActiveFedora::SolrService.instance.conn.commit
end
@cjcolvar
cjcolvar / gist:6466652
Created Sep 6, 2013
Cap deploy output on mallorn
View gist:6466652
** [out :: mallorn.dlib.indiana.edu] An error has occurred, all later migrations canceled:
** [out :: mallorn.dlib.indiana.edu]
** [out :: mallorn.dlib.indiana.edu] undefined method `gsub' for 0:Fixnum
** [out :: mallorn.dlib.indiana.edu] /var/www/avalon/shared/gems/ruby/1.9.1/gems/om-3.0.3/lib/om/xml/term_value_operators.rb:165:in `block (2 levels) in insert_from_template'
** [out :: mallorn.dlib.indiana.edu] /var/www/avalon/shared/gems/ruby/1.9.1/gems/om-3.0.3/lib/om/xml/term_value_operators.rb:164:in `each'
** [out :: mallorn.dlib.indiana.edu] /var/www/avalon/shared/gems/ruby/1.9.1/gems/om-3.0.3/lib/om/xml/term_value_operators.rb:164:in `block in insert_from_template'
** [out :: mallorn.dlib.indiana.edu] /var/www/avalon/shared/gems/ruby/1.9.1/gems/nokogiri-1.6.0/lib/nokogiri/xml/builder.rb:293:in `initialize'
** [out :: mallorn.dlib.indiana.edu] /var/www/avalon/shared/gems/ruby/1.9.1/gems/nokogiri-1.6.0/lib/nokogiri/xml/builder.rb:254:in `new'
** [out :: mallorn.dlib.indiana.edu] /var/www/avalon/
@cjcolvar
cjcolvar / gist:6380806
Last active Dec 21, 2015
Instructions for migrating Avalon R1 vagrant box to pre-R2
View gist:6380806
cd avalon-installer-flat
vagrant halt
cd ..
git clone git@github.com:avalonmediasystem/avalon-installer.git
cd avalon-installer
git checkout r2
git submodule update --init
cp -r ../avalon-installer-flat/.vagrant .
cp ../avalon-installer-flat/avalon-install.yml .
vagrant up
You can’t perform that action at this time.