Skip to content

Instantly share code, notes, and snippets.

View jcoyne's full-sized avatar

Justin Coyne jcoyne

  • Stanford University Libraries
  • Minneapolis, MN
View GitHub Profile
@jcoyne
jcoyne / search.rb
Last active November 13, 2019 15:12
Search for Druids
filter = 'wf_wps_ssim:"accessionWF:sdr-ingest-transfer:error"'
search = Blacklight.default_index.search(fq: filter, fl: 'id', rows: 10_000)
druids = search.response['docs'].map {|d| d['id']}
druids = Sidekiq::RetrySet.new do |job|
((klass, method, args) = YAML.load(job.args[0]))
end.map do |doc|
doc['error_message'].sub(%r{.*http://sul-lyberservices-prod.stanford.edu/workflow//objects/(druid:.{11})/.*}, '\1')
end
["druid:dv067yc0690", "druid:dt469gf3081", "druid:ky920wg4012", "druid:bk337cj4274", "druid:fr259mm2512", "druid:fv474yq5934", "druid:dq379sd3137", "druid:jv189bp0832", "druid:dv627hd0865", "druid:fv162qg9812", "druid:gz880xr9536", "druid:jz243nw3598", "druid:bz827kn6480", "druid:fp744tg4855", "druid:jg658nj5435", "druid:jk783gq9820", "druid:px855nm9126", "druid:ch376fv6873", "druid:bj513tx7008", "druid:mp546mj3927", "druid:bh956cq9786", "druid:df253qd2344", "druid:gt608br6686", "druid:bq013ky8003", "druid:ms951zt0048", "druid:fn279jk7616", "druid:fv217kn2691", "druid:fk707gf7514", "druid:cz014dj2495", "druid:cb475qw5208", "druid:hx396ky8951", "druid:cw372fd1981", "druid:hq532jr8640", "druid:jt102my9479", "druid:bx756rm7202", "druid:fr190hz8212", "druid:dx487gv0982", "druid:bh459tv
@jcoyne
jcoyne / gist:e588b17557132666441a41dca6ef5e6c
Last active October 31, 2019 20:50
Check for complete results.
def check(id)
result = Dor::Services::Client::AsyncResult.new(url: "https://dor-services-prod.stanford.edu/v1/background_job_results/#{id}")
return 'good' if result.complete? && result.errors.nil?
return 'not complete' if !result.complete?
result.errors
end
ids = ["18157", "18108"]
ids.each { |id| puts id if check(id) == 'good' }
@jcoyne
jcoyne / 01_declaring_controller.html
Last active October 22, 2019 19:26 — forked from noelrappin/01_declaring_controller.html
Copy paste parts from Stimulus Workshop
# app/views/schedule/index.html.erb:29-30
<section class="day-body"
id="day-body-<%= schedule_day.day.by_example("2006-01-02") %>"
data-controller="toggle">
@jcoyne
jcoyne / response.txt
Created July 30, 2019 17:01
"You guys" Slack response
Instead of *guys* perhaps you mean *everyone*? ...[Please consider editing your response so it's more inclusive]
Instead of *guys* perhaps you mean *y'all*? ...[Please consider editing your response so it's more inclusive]
Instead of *guys* perhaps you mean *team*? ...[Please consider editing your response so it's more inclusive]
Instead of *guys* perhaps you mean *colleagues*? ...[Please consider editing your response so it's more inclusive]
Attaching to sinopia_editor_platformdata_1
platformdata_1 | 2019/06/06 13:28:50 Waiting for: tcp://platform:8080
platformdata_1 | 2019/06/06 13:28:50 Connected to tcp://platform:8080
platformdata_1 | creating root container
platformdata_1 | creating repository container
platformdata_1 | creating alberta group container
platformdata_1 | creating boulder group container
platformdata_1 | creating chicago group container
platformdata_1 | creating cornell group container
platformdata_1 | creating dlc group container
require 'active_support'
require 'active_support/multibyte/unicode'
string = "有名人やアニメ、風景などいろいろな画像を探したいならYahoo!検索(画像)。サイズ別、色別での絞り込みが可能なだけでなく、スライドショー機能も搭載。加えて、今検索されているキーワードもリアルタイムでわかるので、話題の画像がチェックできます。"
require 'benchmark'
n = 1_000_000
Benchmark.bmbm do |x|
x.report("for:") { for i in 1..n; ActiveSupport::Multibyte::Unicode.tidy_bytes(string); end }
end
#!/usr/bin/env ruby
# frozen_string_literal: true
# Usage:
# ./bin/set-active-version <pathToVersionCSV>
puts 'Loading environment...'
require File.expand_path('../config/environment', __dir__)
require 'csv'
@jcoyne
jcoyne / out.log
Created March 19, 2019 15:47
workflow getting slow then stopping
```
App 20285 stdout: [17b17870-b711-404b-a729-cafa047e3281] Processing by WorkflowQueuesController#show as XML
App 20285 stdout: [17b17870-b711-404b-a729-cafa047e3281] Parameters: {"completed"=>"dor:gisAssemblyWF:wrangle-data", "lane-id"=>"default", "limit"=>"100", "waiting"=>"dor:gisAssemblyWF:package-data"}
App 20233 stdout: [78bea94a-70a7-4473-8e1d-946c4a5dd2bb] Rendering workflow_queues/show.xml.builder
App 20233 stdout: [78bea94a-70a7-4473-8e1d-946c4a5dd2bb] Rendered workflow_queues/show.xml.builder (0.1ms)
App 20233 stdout: [78bea94a-70a7-4473-8e1d-946c4a5dd2bb] Completed 200 OK in 185ms (Views: 0.6ms | ActiveRecord: 182.8ms)
App 20233 stdout: [95fab39f-c36d-448b-9070-c8890909d3ac] Started GET "/workflow_queue/lane_ids?step=dor%3AgisAssemblyWF%3Aextract-boundingbox" for 171.67.35.38 at 2019-03-19 08:43:40 -0700
App 20233 stdout: [95fab39f-c36d-448b-9070-c8890909d3ac] Processing by WorkflowQueuesController#lane_ids as XML
App 20233 stdout: [95fab39f-c36d-448b-9070-c8890909d3ac] Parameters: {"ste
@jcoyne
jcoyne / bnf.json
Created March 4, 2019 16:59
Sample BnF record that has a URL for the identifier.
{"cho_title":["The Bahá'í world : a biennial international record. Volume VII., April 1936 - April 1938 / prepared under the supervision of the National Spiritual Assembly of the Baha'is of the United States and Canada with the approval of Shoghi Effendi"],"cho_date":["1939"],"cho_description":["Numérisé par le partenaire","Appartient à l’ensemble documentaire : BbLevt0","Numérisé par le partenaire"],"cho_dc_rights":["domaine public","public domain"],"cho_format":["xxiii, 303 pages : illustrations ; 26 cm","Nombre total de vues : 934"],"cho_publisher":["(New York)"],"cho_relation":["Notice du catalogue : http://catalogue.bnf.fr/ark:/12148/cb445887770"],"cho_source":["Bibliothèque Orientale de l'Université Saint-Joseph de Beyrouth, 140 D6"],"cho_contributor":["National Spiritual Assembly of the Bahá'ís of Canada"],"cho_edm_type":["text"],"cho_language":["French"],"id":"https://gallica.bnf.fr/ark:/12148/bpt6k91073505","agg_data_provider":"Bibliothèque Orientale","agg_provider":"Bibliothèque nationale de France"