Skip to content

Instantly share code, notes, and snippets.

View pgmccann's full-sized avatar

Paddy McCann pgmccann

View GitHub Profile
@pgmccann
pgmccann / utils.plugin.zsh
Last active April 25, 2017 11:49
Having "man <cmd>" fall back on "<cmd> --help" in zsh with oh-myzsh colored-man-pages
function man() {
CLRD_MAN=$ZSH/plugins/colored-man-pages/colored-man-pages.plugin.zsh
PGR='less'
OTHER_OPTS=0
while getopts ":P:" opt; do
case $opt in
P ) PGR=$OPTARG ;;
? ) OTHER_OPTS=1 ;;
esac
done
@pgmccann
pgmccann / convert_to_djvu.sh
Created May 27, 2016 09:03
Create single DjVu file from TIFFs
#!/bin/bash
function make_page_djvu {
i=$1
j=`basename $i .tif`
convert $i $j.jpg
c44 $j.jpg $j.djvu
if [ -f UYLY205-2.djvu ]; then
djvm -i UYLY205-2.djvu $j.djvu
else
cp $j.djvu UYLY205-2.djvu
@pgmccann
pgmccann / tiff_obj_pages.txt
Created May 3, 2016 14:45
Solr query parameters to find Islandora Page objects belonging to a specified book which have both TIFF and OBJ datastreams
RELS_EXT_hasModel_uri_ms:info\:fedora/islandora\:pageCModel AND fedora_datastreams_ms:OBJ AND fedora_datastreams_ms:TIFF AND RELS_EXT_isPageOf_ms:info\:fedora/[namespace]\:[id]
@pgmccann
pgmccann / do_var_dump.php
Created October 5, 2015 14:19
Formatted var_dump() for HTML output
<?php
function do_var_dump($object) {
echo "<pre>";
var_dump($object);
echo "</pre>";
}
?>
@pgmccann
pgmccann / postgres_query.php
Created October 5, 2015 14:14
Execute Postgres Query
<?php
//Thanks to Swithun Crowe
function do_query($query, $params=array()) {
$result = pg_query_params($query, $params) or die('Query failed: ' . pg_last_error());
return $result;
}
?>
@pgmccann
pgmccann / Islandora iaBookCModel objects to bookCModel objects
Last active August 29, 2015 14:06
Convert Islandora iaBookCModel objects to bookCModel objects (moving from Islandora 6 to 7)
grep -rl "<fedora-model:hasModel rdf:resource=\"info:fedora/islandora:iaBookCModel\">" fedora/data/objectStore/ | xargs sed -i 's@<fedora-model:hasModel rdf:resource="info:fedora/islandora:iaBookCModel">@<fedora-model:hasModel rdf:resource="info:fedora/islandora:bookCModel">@g'
@pgmccann
pgmccann / styles.less
Created April 17, 2014 08:59
Condensed tree view for http://atom.io. Modify stylesheet using Atom > Open Your Stylesheet.
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/