Skip to content

Instantly share code, notes, and snippets.

View anggrilib's full-sized avatar

anggrilib

  • Appalachian College Association
View GitHub Profile
from datetime import date, datetime
# Get today's date
today = date.today()
# Calculate December 31 of (current year + 5)
expiration_year = today.year + 5
expiration_date = date(expiration_year, 12, 31)
# Format as YYYY-MM-DDThh:mm:ss
@anggrilib
anggrilib / calculate-expiry.py
Created October 30, 2025 14:39
Generate OCLC Patron Expiration Date (Dec 31 +5 Years) — Python Example
from datetime import date, datetime
# Get today's date
today = date.today()
# Calculate December 31 of (current year + 5)
expiration_year = today.year + 5
expiration_date = date(expiration_year, 12, 31)
# Format as YYYY-MM-DDThh:mm:ss
@anggrilib
anggrilib / fiveTabNoIconsWidgetBC.txt
Last active September 25, 2025 21:32
Bethany College Discovery search multi-widget safe replaced HTML id attributes in OCLC Search Generator Code with class attributes
<!-- Bethany College WorldCat Discovery search box (Multi-widget safe class structure with OCLC styling) -->
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel="stylesheet"
integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN"
crossorigin="anonymous">
<style type="text/css">
/* OCLC CSS rules but adapted for class-based selectors for multi-widget support */
.worldcat-search-box, .worldcat-search-box * {
box-sizing: border-box !important;
@anggrilib
anggrilib / ju-discovery-history-update.html
Last active February 6, 2025 23:01
ju-discovery-history-5-tab-news-expander
<style type="text/css">
.worldcat-search-box, .worldcat-search-box * {box-sizing:border-box!important;margin:0;padding:0;text-align:left}
.worldcat-search-box .material-tab{display:inline-block;user-select:none;cursor:pointer;background-color:#002856;color:#fff;min-height:2em;min-width:1.5rem;padding:.5em;box-sizing:border-box;border-radius:.25em .25em 0 0;margin-right:.4em;z-index:2}
.worldcat-search-form{position:relative;width:auto;padding:1.25em 2em 2em;background-color:#f2f2f2!important;color:#333!important;z-index:1;line-height:initial}
.worldcat-search-box .material-tab.active-tab{background-color:#f2f2f2!important;color:#333!important}
.worldcat-index-container{position:relative;height:3em;background-color:white;color:black}
.worldcat-index-container:after{content:'\f078';display:block;font-family:'FontAwesome',sans-serif;position:absolute;top:0;right:.5em;line-height:3em;z-index:5}
.worldcat-index-container .worldcat-search-select{position:relative;z-index:10;height:100%;min-width:initi
@anggrilib
anggrilib / sierra-item-loc-agency-error.py
Created October 16, 2024 17:58
Sierra mismatched agency and location codes
##run SQL and write csv for sierra items with mismatched agency and location
import psycopg2
import csv
##change report directory and bool number
report = "/your/path/your/csv/filename.csv"
query = """
SELECT
i.record_type_code || record_num || 'a' AS "Item"/*,
@anggrilib
anggrilib / sierrasqlcsvfines.py
Created October 16, 2024 17:50
Run a Sierra SQL query and output CSV file
##python template for Sierra SQL query
##write csv for fines to local directory
##copied SQL from github jmgold/SQL Queries
##Patrons with high fines detail.sql
##find/replace FIND '[insert ' in this script for prompts REPLACE [insert /prompt/with/relevant/value
import psycopg2
import csv
@anggrilib
anggrilib / c5-toc4-converter-select-db.py
Last active October 15, 2024 19:34
Reformat C5 Database Report (JSON) to C4 DR (CSV)
#workaround to select databases for electronic resource analysis in Springshare LibInsight
#c5DR from libinsight Fetch List to c4 CSV for custom upload
import json
import csv
from collections import defaultdict
from datetime import datetime
import os
import glob
@anggrilib
anggrilib / ju-discovery-search.html
Created October 11, 2024 18:38
5-tab Discovery search box rewrite for Johnson University
<! -- reformat HTML from OCLC Service Configuration Discovery Search Box Generator
workaround to create a temporary form when search is submitted instead of directly opening search URL with search box
-->
<! -- search box style - replace with HTML from OCLC search Box Generator as needed -->
<style type="text/css">
.worldcat-search-box, .worldcat-search-box * {box-sizing:border-box!important;margin:0;padding:0;text-align:left}
.worldcat-search-box .material-tab{display:inline-block;user-select:none;cursor:pointer;background-color:#002856;color:#fff;min-height:2em;min-width:1.5rem;padding:.5em;box-sizing:border-box;border-radius:.25em .25em 0 0;margin-right:.4em;z-index:2}
.worldcat-search-form{position:relative;width:auto;padding:1.25em 2em 2em;background-color:#f2f2f2!important;color:#333!important;z-index:1;line-height:initial}