Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Stompro stompro

  • Moorhead, MN USA
View GitHub Profile
@stompro
stompro / Readme.txt
Created Mar 9, 2020
Evergreen Wordpress Library Bookshelf API Update
View Readme.txt
Steps to setup remote updating of library bookshelfs for Evergreen libraries.
1. As of Library Bookshelf version 4.9 the plugin nees some changes made to allow updating via the REST API.
Apply the changes in the patch file.
patch -i librarybookshelf.patch
2. Install the application password wordpress plugin. Then edit your wordpress user account and add an application password. Record the password.
@stompro
stompro / Testing Content Cafe BTOL
Last active Mar 9, 2020
Clear no-content cover art entries from memcached
View Testing Content Cafe BTOL
Here is one way to test to see what Content Cafe is returning.
This does sequential requests for a given ISBN and shows the size and return code.
You need to put in your own username and password for content cafe.
while [ true ]; do curl -s -o /dev/null -w "%{http_code} %{size_download} %{content_type}\n" 'http://images.btol.com/ContentCafe/Jacket.aspx?UserID=xxxxxx&Password=yyyyyyy&NotFound=T&Size=L&Value=9781250179760'; date; done
our results look like the following, notice that the image size bounces between 2723 and 42435, which is the correct image and the no-content image.
@stompro
stompro / Xul example.json
Created Jan 24, 2020
Evergreen Item Templates XUL vs Web
View Xul example.json
"hrefmn Ad Bk Ref MN Non Fiction": {
"Status": {
"value": "5",
"field": "status",
"type": "attribute"
},
"Price": {
"value": "30.00",
"field": "price",
"type": "attribute"
@stompro
stompro / Sync old and new item alerts.sql
Created Nov 5, 2019
Evergreen Old and New Item Alert Sync
View Sync old and new item alerts.sql
-- Copy old asset.copy(alert_message) to asset.copy_alert and vice versa
-- For situations when some staff are still using xul and some have moved to web staff client.
CREATE FUNCTION larl_copy_old_new_alert() RETURNS trigger AS $larl_copy_old_new_alert$
BEGIN
-- alert_message is now null - mark matching asset.copy_alert as clear
if NEW.alert_message is null then
update asset.copy_alert
set ack_time = now()
@stompro
stompro / email-lost-post.sql
Created Sep 17, 2019
Evergreen Email Bills Preprocessing
View email-lost-post.sql
\echo Post-Hook SQL Scripts - Run after new events have been created.
begin;
\echo Summary of events for event_def=117
select state,count(id) from action_trigger.event where event_def=117 group by state;
\echo Change event to invalid if patron has no email address.
update action_trigger.event ate
set state='invalid',update_time=now()
@stompro
stompro / Auditor tables bloat cleanup.sql
Last active Jul 15, 2019
Evergreen ILS Index and Table Bloat Notes
View Auditor tables bloat cleanup.sql
-- Auditor Bloat and cluster
--------------------------------
-- cluster asset_copy_history
-- Create index to cluster on
create index aud_asset_cp_cluster on auditor.asset_copy_history using btree(id,audit_id);
cluster verbose auditor.asset_copy_history using aud_asset_cp_cluster;
--remove cluster index
@stompro
stompro / evergreen
Created Feb 8, 2019
cat /etc/init.d/evergreen - Evergreen startup scripts
View evergreen
#!/bin/bash
### BEGIN INIT INFO
# Provides: evergreen
# Required-Start: $remote_fs $syslog ejabberd
# Should-Start: postgresql memcached apache2
# Required-Stop: $remote_fs $syslog
# Should-Stop: apache2 memcached postgresql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@stompro
stompro / auth-purge-00-notes.txt
Last active Jun 16, 2018
Purge unused authority records - Evergreen ILS
View auth-purge-00-notes.txt
Before you try to clean up your authority records, you should have run the authority linking scripts,
and then set them up to run on a regular basis via cron.
#Link bibs to authorities
/openils/bin/authority_control_fields.pl -a
#Link authorities to other authorities.
/openils/bin/authority_authority_linker.pl -a
@stompro
stompro / stat-cat-cross-tab.sql
Created Apr 6, 2018
Stat Cat Cross Tab Report
View stat-cat-cross-tab.sql
rollback;
begin;
select larl_temp.colpivot('_output',$$
select --acn.record
acp.id
, acp.barcode
, acp.circ_modifier
,ascc.name, asce.value
View series fixes.sql
-- List of all 490 a
select mrfr.value,count(distinct mrfr.record),string_agg(distinct mrfr.record::text,', ') from metabib.real_full_rec mrfr
where
mrfr.tag='490'
and mrfr.subfield='a'
--limit 100
group by mrfr.value