Skip to content

Instantly share code, notes, and snippets.

View orangewolf's full-sized avatar

Rob Kaufman orangewolf

View GitHub Profile
namespace :hyrax do
namespace :reset do
desc 'Reset fedora / solr and corrisponding database tables w/o clearing other active record tables like users'
task :works_and_collections => [:environment] do
confirm('You are about to delete all works and collections, this is not reversable!')
require 'active_fedora/cleaner'
ActiveFedora::Cleaner.clean!
Hyrax::PermissionTemplateAccess.delete_all
Hyrax::PermissionTemplate.delete_all
Delayed::Job.delete_all
#!/usr/bin/env ruby
require 'rest-client'
require 'json'
API_KEY=''
def checks
return @checks if @checks
@checks = RestClient.get("https://healthchecks.io/api/v1/checks/", {"X-Api-Key" => API_KEY })
@checks = JSON.parse(@checks.body)['checks']
# Remove orphan search records from a collection
search = ActiveFedora::SolrService.get("member_of_collection_ids_ssim: 6h440t714", rows: 100000); nil
search['response']['docs'].each do |doc|
if Work.where(id: doc['id']).blank?
ActiveFedora::SolrService.delete(doc['id'])
end
end; nil
let token = "FAKE" // Get the token from local storage
let headers = { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}`}
fetch("http://localhost:3000/admin/users", {headers: headers})
# !/usr/bin/env ruby
# frozen_string_literal: true
puts 'Installing ZK and Zookeper gems'
system('CFLAGS=-Wno-error=format-overflow gem install zookeeper --version 1.4.11')
system('CFLAGS=-Wno-error=format-overflow gem install zk')
# Create a new Solr collection
class CreateSolrCollection
require 'faraday'
export LC_CTYPE="en_US.UTF-8"
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:$HOME/.fastlane/bin:${HOME}/.krew/bin:/usr/local/sbin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/rob/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#ZSH_THEME="wedisagree"
@orangewolf
orangewolf / decrypt
Last active September 1, 2020 17:51
Solr in Helm
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR/../../chart
echo $DIR
REPO=$(basename $(git config --get remote.origin.url))
NAMESPACE=${REPO%.git}
if [ -z "$1" ]
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "app.setup.name" . }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
adns
amazon-ecs-cli
ansible
aom
apr
apr-util
aspell
augeas
autoconf
automake
org.infinispan.persistence.spi.PersistenceException: java.io.StreamCorruptedException: Unexpected byte found when reading an object: 50
at org.infinispan.marshall.core.MarshalledEntryImpl.unmarshall(MarshalledEntryImpl.java:116)
at org.infinispan.marshall.core.MarshalledEntryImpl.getValue(MarshalledEntryImpl.java:61)
at org.infinispan.persistence.PersistenceUtil.convert(PersistenceUtil.java:136)
at org.infinispan.persistence.PersistenceUtil$4.compute(PersistenceUtil.java:106)
at org.infinispan.container.DefaultDataContainer$BoundedEquivalentConcurrentExtendedMap$2.apply(DefaultDataContainer.java:539)
at org.infinispan.container.DefaultDataContainer$BoundedEquivalentConcurrentExtendedMap$2.apply(DefaultDataContainer.java:536)
at org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8.compute(BoundedEquivalentConcurrentHashMapV8.java:3430)
at org.infinispan.container.DefaultDataContainer$BoundedEquivalentConcurren