Skip to content

Instantly share code, notes, and snippets.

@pgwillia
pgwillia / feature_flag.md
Created November 5, 2025 23:55
Flipper Feature Flags in Jupiter
@pgwillia
pgwillia / 2025-08-08 - users - Allard Community League Membership - All Tags - All Roles.csv
Created August 12, 2025 20:48
Making up some community league membership data to demonstrate how it could be used by leagues
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 24 columns, instead of 20 in line 2.
Member ID,First Name,Last Name,Email,Telephone,Address,Address 2,Postal Code,City,"State/Province,Country",Joined,Base Plan,Family Members,Membership Status,Tags,Business Name,Account Created,Activities/Programs of Interest,Other Programs of Interest,Skills to Offer,Other Skills to Offer,Skate Tags,# of Skate Tags for Membership Card,Consent to EFCL News & Updates
24-1,Denna,Vandervort,[email protected],780-636-4377 x6228,22589 Clayton Motorway,"",A6S9P6,Edmonton,AB,2023-10-17,Individual,Gwyneth;Melodee,Active,Block connector;Soccer;Community Garden;Casino;Sign;Seniors/Retirees programs,"",2023-10-17,Drop In Sports Adults;Learn To Skate,"",Engagement;Event planning and/or support;Organizational Office Skills,"",No,"",no
24-2,Debi,Hessel,[email protected],438-804-9039,9005 Willms Springs,Suite 765,G2T6C5,Edmonton,AB,2025-07-16,Individual,Leisha,Active,Newsletter;Community Cleanup;Deliver flyers for events or meetings,"",2025-07-16,Block parties;Soccer;Baby And Toddlers,"",Organizational Office Sk
@pgwillia
pgwillia / istl_url.rb
Created July 31, 2025 22:38
Use DataCite API to complete Old URL column for ISTL journal migration
require 'net/http'
require 'json'
require 'csv'
CSV.open('istl_url.csv', 'wb') do |csv|
csv << ['doi', 'url']
File.open("istl_doi.txt") do |f|
f.each_line(chomp: true) do |doi|
source = URI.parse("https://api.datacite.org/dois/#{doi}")
@pgwillia
pgwillia / missing_thumbnails.rb
Last active July 24, 2025 17:16
How to get report of missing thumbnails from Scholaris DSpace
require 'net/http'
require 'cgi'
require 'json'
File.open('missing_thumbnails.txt', 'w') do |file|
source = URI.parse('https://ualberta.scholaris.ca/server/api/discover/search/objects?sort=score,DESC&page=0&size=100&configuration=administrativeView&embed=thumbnail&embed=item/thumbnail&embed=accessStatus')
loop do
print '.'
resp = Net::HTTP.get_response(source)
data = resp.body
@pgwillia
pgwillia / create_aip.rb
Last active June 3, 2025 17:32
Parsing PMPY preservation_event.json
# There are some example of scripts in /var/pushmi_pullyu/bin on middlesbrough. Can we do the same kind of thing on prod?
PushmiPullyu::AIP.create(uuid: <uuid>, type: 'items') do |aip_filename, aip_directory|
puts "HENRY: aip_filename=#{aip_filename}"
puts "HENRY: aip_directory=#{aip_directory}"
end
@pgwillia
pgwillia / Gemfile
Last active May 15, 2025 18:22
Use ActiveRecord + SQLite without Rails (originally https://subinsb.com/ruby-activerecord-sqlite/)
source "https://rubygems.org"
gem "activerecord", "~> 8.0"
gem "pry"
gem "sqlite3", "~> 2.4"
@pgwillia
pgwillia / open_access.rb
Created March 14, 2025 22:20
Open access report for ERA
CSV.open('open_access.csv', 'wb') do |csv|
csv << ['year', 'count', 'community', 'collection', 'collection url']
open_access_items = Item.select(:member_of_paths, :created_at)
.where(visibility: JupiterCore::VISIBILITY_PUBLIC)
.group_by { |item| item.created_at.year }
open_access_items.each do |year, items|
items.map(&:member_of_paths).flatten.tally.each do |member_of_path, count|
community_id, collection_id = member_of_path.split('/')
csv << [year, count, Community.find(community_id).title, Collection.find(collection_id).title,
Rails.application.routes.url_helpers.community_collection_url(community_id, collection_id)]
@pgwillia
pgwillia / publishing_datacite_dois.rb
Created March 13, 2025 21:09
Creating a list of publishing doi's from json export files
require 'csv'
require 'json'
CSV.open('publishing_datacite_dois.csv', 'wb') do |csv|
csv << ['doi', 'title', 'url']
["10.18733.json", "10.20360.json", "10.21225.json", "10.21971.json", "10.18740.json", "10.20361.json", "10.21432.json", "10.21991.json", "10.25336.json"].each do |filename|
file = File.open filename
data = JSON.load file
data["data"].each do |doi|
csv << [doi["attributes"]["doi"], doi["attributes"]["titles"][0]["title"], doi["attributes"]["url"]]
@pgwillia
pgwillia / open_access.csv
Last active February 25, 2025 20:42
ERA Open Access report
year count community collection collection url
2025 22 The department of Cat The annals of 'Cat International' http://era.lvh.me:3000/communities/16ebf0dd-19f0-4ee7-a8f5-dfd533652a81/collections/786ee7fe-c345-4a92-8a3e-833724737f62
2025 2 The department of Cat Theses about cats http://era.lvh.me:3000/communities/16ebf0dd-19f0-4ee7-a8f5-dfd533652a81/collections/618912fe-0d3f-470b-bb99-1ee7bacd69a3
2025 22 The department of Unicorn The annals of 'Unicorn International' http://era.lvh.me:3000/communities/d49ff70a-24fd-42a5-97d0-ac1c7747f56e/collections/99df8858-f7bc-4c25-9dc2-cc7181ced3fc
2025 22 Special reports about dogs The annals of 'Dog International' http://era.lvh.me:3000/communities/0917355b-39a7-4484-bdc7-43e9a6a0ee39/collections/2b8f986f-5123-4148-82fb-56794da56cc9
2025 2 Special reports about dogs Theses about dogs http://era.lvh.me:3000/communities/0917355b-39a7-4484-bdc7-43e9a6a0ee39/collections/61618a4e-16a7-4814-bd23-80afbc38f396
2025 2 The department of Unicorn Theses about unicorns http://era.lv