Skip to content

Instantly share code, notes, and snippets.

@gmcharlt
gmcharlt / perl_xpath.sql
Last active December 17, 2015 06:49
PL/Perl replacement for PostgresSQL 9.2+ xpath() function that preserves namespace declarations
CREATE OR REPLACE FUNCTION perl_xpath (xpath TEXT, doc XML, ns TEXT[][]) RETURNS TEXT[] AS $func$
use strict;
use XML::LibXML;
my $xpath = shift;
my $doc = shift;
my $ns_string = shift || '';
my %ns_list = $ns_string =~ m/\{([^{,]+),([^}]+)\}/g;
@gmcharlt
gmcharlt / test.koc
Created February 19, 2014 17:46
Sample Koha Offline Circulation (KOC) file
Version=1.0 Generator=kocQt4 GeneratorVersion=1.0
2014-02-19 09:41:57 474 issue PATRON-ABC ITEM-1
2014-02-19 09:41:57 586 issue PATRON-ABC ITEM-2
2014-02-19 09:41:57 586 issue PATRON-ABC ITEM-3
2014-02-19 09:41:57 587 issue PATRON-ABC ITEM-4
@gmcharlt
gmcharlt / gist:ab8d14ece1090df48fcb
Created October 8, 2014 17:33
Testing ADE 4.0 on Win 7
Starting point: a Win 7 box that already had ADE 1.7 installed on it as well as a
copy of Calibre with some books in its library.
1. Downloaded and installed ADE 4.0.
2. Allowed it to associate with .acsm and .epub files.
3. Fired up WireShark
4. Let it run it's post-install option to migrate the library from ADE 1.7.
5. Read some pages of an existing book in ADE 4.0. Saw POST to adelogs.adobe.com
mentioning that book.
6. Opened an EPUB file by double-clicking on it.
@gmcharlt
gmcharlt / gist:50707d56ebcb3162e195
Created October 9, 2014 16:57
ADE 4.0 sending book metadata from a connected Sony Reader in the clear
POST /datacollector/ping?id=com.adobe.rmsdk.nocert.dewin HTTP/1.1
Accept: */*
Content-Type: application/vnd.adobe.dc+xml
User-Agent: book2png
Host: adelogs.adobe.com
Content-Length: 130
Cache-Control: no-cache
Cookie: s_vi=[CS]v1|2906707D0507A2C6-60000101A011490C[CE]
"id":"com.adobe.rmsdk.nocert.dewin","h":"704dd1a4d745604cf328b5cd97261869d4e2f2285c4de0514bdfe583b136203f","d":{"dcversion":"1.0"}HTTP/1.1 200 OK
@gmcharlt
gmcharlt / ping
Last active August 29, 2015 14:08
Emulate the "ping" and "receiver" service of the Adobe Digital Editions data collector
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use Data::Dumper;
my $input = CGI->new();
open my $log, '>>', '/tmp/datacollector-log';
@gmcharlt
gmcharlt / del-linkroll.js
Created October 27, 2014 03:56
Resurrecting the Delicious Linkroll
/*
FILE ARCHIVED ON 8:24:05 Feb 21, 2012 AND RETRIEVED FROM THE
INTERNET ARCHIVE ON 3:48:08 Oct 27, 2014.
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

Keybase proof

I hereby claim:

  • I am gmcharlt on github.
  • I am gmcharlt (https://keybase.io/gmcharlt) on keybase.
  • I have a public key whose fingerprint is A9D9 D7FC C580 64EC 664D 716D 134A 76B7 43D9 8630

To claim this, I am signing this object:

@gmcharlt
gmcharlt / draft_c4l_photo_audio_video_policy.md
Last active August 29, 2015 14:14
Draft Code4Lib Photography/Audio/Video policy

This policy applies to all attendees of Code4Lib events, including event staff who are designated as official photographers and audio and video recorders.

Do not photograph, video or audio record anyone without their express permission.

During the Code4Lib conference, most attendees will have different colored badge lanyards or ribbons showing their preference for photography, for example:

  • Green: Photographs always okay
  • Yellow: Ask before photographing
  • Red: Photographs never okay, don’t ask
$ cd /path/to/Evergreen/repo && git checkout master && git pull
$ git rev-list --objects --all | awk '$2' | sort -k2 | uniq -cf1 | sort -rn |
> while read frequency sample path
> do
> [ "blob" == "$(git cat-file -t $sample)" ] && echo -e "$frequency\t$path";
> done | head
1426 Open-ILS/src/sql/Pg/002.schema.config.sql
1164 Open-ILS/examples/fm_IDL.xml
1135 Open-ILS/src/sql/Pg/950.data.seed-values.sql
@gmcharlt
gmcharlt / koha-ldap-server.pl
Created February 27, 2015 17:16
Proof-of-concept LDAP server that supports authentication-via-bind-only against a Koha patron database.
#!/usr/bin/perl
# Proof-of-concept LDAP server that supports
# authentication-via-bind-only against a Koha
# patron database.
use strict;
use warnings;
package KohaLDAPServer;