Skip to content

Instantly share code, notes, and snippets.

Avatar
Verified

David Kinzer dkinzer

Verified
View GitHub Profile
@dkinzer
dkinzer / pry20201022-13879-1prluqv.rb
Last active Oct 23, 2020
compose in Ruby defined as a reduction of its arguments.
View pry20201022-13879-1prluqv.rb
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 Apr 27, 2020
Versioned Templated Dag Example
View template.py
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
View exract_xpath_bug_spec.rb
# 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(
View Enabling Solr Document Versioning.md
View load_test_asrs.rb
#!/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")
View lazy.rb
require "thread"
class Delay
def initialize(&thunk)
@semaphore = Mutex.new
@thunk = thunk
@evaluated = false
end
def value
View alma-20180712-85988-19f3fzm.xml
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?><OAI-PMH xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd" xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<responseDate>2018-07-12T08:54:11Z</responseDate>
<request verb="ListRecords" metadataPrefix="marc21" set="blacklight" until="2018-07-12T08:54:02Z" from="2018-07-12T00:54:00Z">https://na02.alma.exlibrisgroup.com/view/oai/01TULI_INST/request</request>
<ListRecords><record><header><identifier>oai:alma.01TULI_INST:991000022389703811</identifier><datestamp>2018-07-12T08:19:13Z</datestamp><setSpec>blacklight</setSpec><setSpec>blacklight_qa</setSpec><setSpec>rapid_print_books</setSpec></header><metadata>
View indexer_config.rb
# frozen_string_literal: true
$:.unshift "./config"
$:.unshift "./lib"
require "yaml"
solr_config = YAML.load_file("config/blacklight.yml")[(ENV["RAILS_ENV"] || "development")]
solr_url = ERB.new(solr_config["url"]).result
# A sample traject configuration, save as say `traject_config.rb`, then
# run `traject -c traject_config.rb marc_file.marc` to index to
View ingest-record.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
require File.expand_path("../../config/environment", __FILE__)
indexer = Traject::Indexer.new
indexer.load_config_file("./lib/traject/indexer_config.rb")
View twitter-bio.txt
Coding for TU Library with love, ruby, rails, blacklight, solr and vim (etc.). Living la vida father, husband, dancer, poet, clown. My mind -> my opinions.
You can’t perform that action at this time.