Skip to content

Instantly share code, notes, and snippets.

View dkinzer's full-sized avatar

David Kinzer (he/him) dkinzer

View GitHub Profile

How to trigger a Jenkins job when merging to master on GitHub

Sometimes you want be able to trigger a jenkins job whevever you merge to master.
Fortunately there is a very useful Jenkins Plugin called Generic Webhook Trigger Plugin to help. This plugin is not specific to GitHub. It should work with any service that can post to a webhook.

The plugin let's you parse the JSON payload using either JSONPath or XPath; it even let's you set up key values based on the POST Headers or URL arguments.

#!/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
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>
<record xmlns="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" ><leader>01391nam a2200457 a 4500</leader><controlf
#!/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")
# 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
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.
@dkinzer
dkinzer / aws_utils.sh
Last active December 10, 2018 05:10
Library to help increase ec2 instance root volume size.
#!/usr/bin/env bash
AWS_DEFAULT_ZONE='us-east-1'
aws_status()
{
echo $(aws ec2 describe-instances --instance-ids="$1" | jq -r '.Reservations[0].Instances[0].State.Name')
}
aws_snapshot_status()
create
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create Gemfile
run git init from "."
Initialized empty Git repository in /private/var/folders/l8/8ljsh0p103d9m4gg3866jlhh0000gp/T/d20181002-80571-1d5ukjn/internal/.git/
create package.json
YR 2016
K1 Drori, Amit
K1 Puppetry
K1 Visual Artists
K1 Theater
K1 Animation
K1 Philosophy
K1 Open Access
K1 Robotics
K1 Robot As Puppet