Skip to content

Instantly share code, notes, and snippets.

View stompro's full-sized avatar

Josh Stompro stompro

  • Moorhead, MN USA
View GitHub Profile
@stompro
stompro / zz-lp1752334-badcontact.t
Created March 7, 2023 14:01
/home/opensrf/Evergreen/Open-ILS/src/perlmods/live_t/zz-lp1752334-badcontact.t
#!perl
use strict; use warnings;
use Test::More tests => 7;
use OpenILS::Utils::TestUtils;
use OpenILS::Const qw(:const);
use OpenILS::Utils::Fieldmapper;
use Data::Dumper;
my $script = OpenILS::Utils::TestUtils->new();
@stompro
stompro / clearcoverart.bash
Created February 28, 2023 14:35
Clear jacket art from Evergreen Memcache
#!/bin/bash
## Script clears entrys and tries to re-fetch the cover art. Runs slow.
## Enter your server address below.
NUMTRIES=2
for KEY in $(memcdump --servers=localhost |fgrep 'ac.jacket')
do
if [[ $(memccat --servers=localhost $KEY) =~ "nocontent" ]]
then
@stompro
stompro / Samsung 850 Pro - MP1
Created February 7, 2023 20:04
Samsung 850 Pro - MP1
mint@mint:~$ sudo smartctl -a /dev/sda
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-56-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Samsung based SSDs
Device Model: Samsung SSD 850 PRO 256GB
Serial Number: S251NXAH205328P
LU WWN Device Id: 5 002538 84017a179
Firmware Version: EXM03B6Q
@stompro
stompro / diff ejabberd.yml ejabberd.yml-orig
Created December 14, 2022 19:24
ejabberd 21.01-2 (Debian 11.5)
root@virt-egdev2:/etc/ejabberd# diff ejabberd.yml ejabberd.yml-orig
17d16
< negotiation_timeout: 60
35,36d33
< - private.localhost
< - public.localhost
70c67
< starttls_required: false
---
> starttls_required: true
@stompro
stompro / update-new-items2.sql
Created December 5, 2022 16:49
Newly arrived items, and newly ordered items lists
begin;
\set regioncode 101
--- Temp table to hold the last 5 months of new titles
CREATE TEMPORARY TABLE new_items
ON COMMIT DROP
AS (
-- New Items
select row_number() over (order by x."Most Recent Active Date" desc nulls last) as rownum, * from (
@stompro
stompro / After galen's patch 2022-11-28.log
Created November 28, 2022 14:32
LP#1971745 - Showing original issue
open-ils.cstore 2022-11-28 08:31:28 [INFO:755698:osrf_app_session.c:1181:16696458887557082] [open-ils.cstore] sent 385 bytes of data to opensrf@private.localhost/open-ils.circ_drone_at_localhost_755529
open-ils.cstore 2022-11-28 08:31:28 [INFO:755698:osrf_stack.c:163:16696458887557082] Message processing duration 0.002142
[2022-11-28 08:31:28] open-ils.circ [INFO:755529:CStoreEditor.pm:155:16696458887557082] editor[0|1] json_query : returned 1 result(s)
[2022-11-28 08:31:28] open-ils.storage [INFO:755705:Application.pm:159:16696458887557082] CALL: open-ils.storage open-ils.storage.action.live_holds.wide_hash.atomic HASH(0x564ef31e11f8), ARRAY(0x564ef31e10c0), ,
[2022-11-28 08:31:28] open-ils.storage [INFO:755705:action.pm:2161:16696458887557082] Received 7 restrictions
[2022-11-28 08:31:33] open-ils.storage [INFO:755705:Transport.pm:163:16696458887557082] Message processing duration: 4.985
[2022-11-28 08:31:37] open-ils.circ [INFO:755529:Transport.pm:163:16696458887557082] Message processing duration: 8.993
@stompro
stompro / Explain for altered wide-hold.txt
Created November 22, 2022 16:14
Evergreen Wide-Hold SQL Queries performance problem
QUERY PLAN
Sort (cost=15787476.75..15787476.77 rows=8 width=1810) (actual time=2236.183..2236.220 rows=466 loops=1)
Output: h.id, h.request_time, h.capture_time, h.fulfillment_time, h.checkin_time, h.return_time, h.prev_check_time, h.expire_time, h.cancel_time, h.cancel_cause, h.cancel_note, h.target, h.current_copy, h.fulfillment_staff, h.fulfillment_lib, h.request_lib, h.requestor, h.usr, h.selection_ou, h.selection_depth, h.pickup_lib, h.hold_type, h.holdable_formats, h.phone_notify, h.email_notify, h.sms_notify, ((SubPlan 4)), h.frozen, h.thaw_date, h.shelf_time, h.cut_in_line, h.mint_condition, h.shelf_expire_time, h.current_shelf_lib, h.behind_desk, h.hopeless_date, (CASE WHEN (h.cancel_time IS NOT NULL) THEN 6 WHEN (h.frozen AND (h.capture_time IS NULL)) THEN 7 WHEN ((h.current_shelf_lib IS NOT NULL) AND (h.current_shelf_lib <> h.pickup_lib)) THEN 8 WHEN (h.fulfillment_time IS NOT NULL) THEN 9 WHEN (h.current_copy IS NULL) THEN 1 WHEN (h.capture_time IS NULL) THEN 2 WHEN (cp.status = 6) THEN 3 WHEN
@stompro
stompro / Log example
Created November 18, 2022 16:35
Evergreen: 30 second timeout of open-ils.circ.hold.wide_hash.stream
[2022-11-18 10:25:19] open-ils.circ [INFO:562514:Application.pm:159:16687887195625133] CALL: open-ils.circ open-ils.circ.hold.wide_hash.stream authhash, HASH(0x558878df78c8), ARRAY(0x558878df7388), ,
open-ils.auth 2022-11-18 10:25:19 [INFO:196413:osrf_application.c:1084:16687887195625133] CALL: open-ils.auth open-ils.auth.session.retrieve "authhash",1
open-ils.auth 2022-11-18 10:25:19 [INFO:196413:oils_event.c:46:16687887195625133] Creating new event: SUCCESS
open-ils.auth 2022-11-18 10:25:19 [INFO:196413:osrf_app_session.c:1181:16687887195625133] [open-ils.auth] sent 916 bytes of data to opensrf@private.localhost/open-ils.circ_drone_at_localhost_562514
open-ils.auth 2022-11-18 10:25:19 [INFO:196413:osrf_stack.c:163:16687887195625133] Message processing duration 0.000416
[2022-11-18 10:25:19] open-ils.circ [INFO:562514:CStoreEditor.pm:155:16687887195625133] editor[0|1] checking perms user=1, org=102, perm=VIEW_HOLD
[2022-11-18 10:25:19] open-ils.circ [INFO:562514:CStoreEditor.pm:155:16687887195625133] editor[
@stompro
stompro / Sync old and new item alerts.sql
Last active July 30, 2021 16:17
Evergreen Old and New Item Alert Sync
-- 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 or replace FUNCTION larl_copy_old_new_alert() RETURNS trigger AS $larl_copy_old_new_alert$
BEGIN
if TG_OP = 'UPDATE' then
-- alert_message is now null - mark matching asset.copy_alert as clear
if NEW.alert_message is null then
update asset.copy_alert
@stompro
stompro / Readme.txt
Created March 9, 2020 14:37
Evergreen Wordpress Library Bookshelf API Update
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.