Skip to content

Instantly share code, notes, and snippets.

@dkinzer
dkinzer / delete_aliases.rb
Created June 27, 2024 14:03
Delete aliases in a solr collection
#! /usr/bin/env ruby
require 'httparty'
solr_url = "https://#{ENV["SOLRCLOUD_HOST"]}/solr/admin/collections"
auth = { username: ENV["SOLR_AUTH_USER"], password: ENV["SOLR_AUTH_PASSWORD"] }
resp = HTTParty.get(solr_url, basic_auth: auth, query: { action: "LIST" })
matcher = ARGV.join || "thisisnotarealcollectionname"
@dkinzer
dkinzer / 0001-Update-references-to-master-branch.patch
Last active November 9, 2021 20:11
Patch for BL Wiki. Updates "master" references to "main"
From 755639b062052ed6b752ab08e220c9ed9857d69a Mon Sep 17 00:00:00 2001
From: David Kinzer <dtkinzer@gmail.com>
Date: Tue, 9 Nov 2021 14:54:55 -0500
Subject: [PATCH] Update references to 'master' branch.
---
Adding-new-document-actions.md | 4 ++--
Atom-Responses.md | 2 +-
Blacklight-configuration.md | 14 +++++++-------
Blacklight-on-Heroku.md | 4 ++--
hello world
FROM harbor.k8s.temple.edu/library/alpine:3.13
CMD [ "echo", "hello world" ]
# build this with:
# docker build --tag=harbor.k8s.temple.edu/tulibraries/hello_world_dkinzer:latest .
# push this with:
# docker push harbor.k8s.temple.edu/tulibraries/hello_world_dkinzer:latest
@dkinzer
dkinzer / pry20201022-13879-1prluqv.rb
Last active October 23, 2020 01:38
compose in Ruby defined as a reduction of its arguments.
def compose(*args)
identity = ->(x) { x }
args.reduce(identity) do |a, b|
if b.is_a? Proc
a >> b
else
a >> method(b)
end
end
@dkinzer
dkinzer / template.py
Last active April 27, 2020 20:06
Versioned Templated Dag Example
from datetime import datetime, timedelta
import os
from airflow.operators.bash_operator import BashOperator
DEFAULT_ARGS = { "retries": 0, catchup: False, max_active_runs: 1, schedule_interval: None }
def create_dag(env, version):
dag_id = "hello_" + env
# frozen_string_literal: true
RSpec.describe Traject::Indexer::NokogiriIndexer do
let(:settings) { {
"nokogiri.each_record_xpath" => "/oai:OAI-PMH/oai:ListRecords/oai:record",
"nokogiri.namespaces" => { "oai" => "http://www.openarchives.org/OAI/2.0/" },
"solr_writer.commit_on_close" => "false",
} }
let(:records) { Traject::NokogiriReader.new(StringIO.new(
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# A script for retrieving a local repository of public and authentication notes
# for electronic collections and services.
#
items_ids = File.readlines("#{ENV["HOME"]}/Downloads/asrs_items.csv")
require "thread"
class Delay
def initialize(&thunk)
@semaphore = Mutex.new
@thunk = thunk
@evaluated = false
end
def value