Skip to content

Instantly share code, notes, and snippets.

View pmgreen's full-sized avatar

Peter Green pmgreen

  • Narrow Ridge Center
  • TN
View GitHub Profile
@pmgreen
pmgreen / openrefine_regexp.md
Last active November 21, 2022 21:49
Quick primer on using regular expressions in OpenRefine.

Using regular expressions in OpenRefine

A regular expression is a string that describes a text pattern occurring in other strings, m'kay.

Basic concepts

With which one can go quite far.

* metacharacters
* character escapes \
* anchors \A\Z or ^$
@pmgreen
pmgreen / cache_dump.py
Last active September 3, 2015 19:03
Get Hathi URLs
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Just get a csv report from the db that's populated by checky_urls.py
from 20150903
pmg
"""
import csv
import sqlite3 as lite
@pmgreen
pmgreen / gist:519ce8ed009c58a472bc
Created September 15, 2014 21:13
Get a random sample of n records per Voyager location
/* Relates to Ex Libris' Voyager ILS. Used in Toad for Oracle Freeware and SQL Developer (not MS Access) */
SELECT * FROM (
SELECT b.BIB_ID, m.MFHD_ID, m.LOCATION_ID, ROW_NUMBER()
OVER (
PARTITION BY m.LOCATION_ID ORDER BY m.LOCATION_ID
) SampleCount FROM BIB_TEXT b LEFT JOIN BIB_MFHD bm ON b.BIB_ID = bm.BIB_ID
LEFT JOIN MFHD_MASTER m ON bm.MFHD_ID = m.MFHD_ID
WHERE m.LOCATION_ID IN
(
'1', '6', '7'