Skip to content

Instantly share code, notes, and snippets.

@haoess
haoess / jp-prov
Last active November 8, 2022 16:21
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-model href="http://www.w3.org/ns/prov.xsd"?>
<prov:document xmlns:prov="http://www.w3.org/ns/prov#" xmlns:jp="http://www.jeanpaul-edition.de/ns">
<prov:entity prov:id="jp:e1">
<prov:label>E. Berend: 3. Abteilung der Historisch-kritischen Ausgabe (1952–1964)</prov:label>
<prov:location>Berlin</prov:location>
<prov:type>Druck-Edition</prov:type>
</prov:entity>
<prov:activity prov:id="jp:a1">
<?xml version="1.0" encoding="UTF-8"?>
<!--
This XSL stylesheet transforms entries from the EHD chronology
to a CSV data sheet.
See https://edition-humboldt.de/chronologie/index.xql
"THE BEER-WARE LICENSE" (Revision 42):
@haoess
haoess / convert.pl
Last active October 8, 2020 15:25
add xml:id to item and target to ref
#!/usr/bin/perl
use 5.012;
use warnings;
binmode STDOUT, ':utf8';
use XML::LibXML;
use XML::LibXSLT;
sub url5005 {
my ($year, $page) = @_;
($page) = $page =~ /(\d+)/;
no warnings 'uninitialized';
if ( $year !~ /\A18\d\d\z/ || $page !~ /\A\d+\z/ ) {
return '';
}
my $m = WWW::Mechanize->new( agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)' );
@haoess
haoess / gist:1339413
Created November 4, 2011 14:16
XPath in vim
let mapleader = ","
nnoremap <leader>xp :call Xpath()<cr>
function! Xpath()
" Needs to get the real file name for the quickfix window
let realname = bufname( "%" )
" Write the buffer to a temp file
let filename = tempname()
@haoess
haoess / formula.pl
Created July 4, 2011 08:47
Create beautiful PNG images from TeX formulae via Perl CGI
#!/usr/bin/perl
use warnings;
use strict;
use Cwd;
use CGI;
use File::Path qw( rmtree );
use File::Slurp qw( read_file );
use File::Temp qw( tempdir tempfile );
@haoess
haoess / gist:803980
Created January 31, 2011 12:53
slow re
#!/usr/bin/perl -w
$buddyicons = '[http://www\.flickr\.com/photos/30482855@N04]' x 1396;
$rx = qr{.*\[(.*/photos/[^\]/]*)/?\]\s*\.(.*)};
$buddyicons =~ $rx;
@haoess
haoess / gist:799281
Created January 27, 2011 21:12
Häufigkeiten der vergebenen Journal-IDs (sortiert)
perl -nE '/&journals;#(jour\d{4})/ && $j{$1}++; END { printf "%s: %d\n", $_, $j{$_} for sort { $j{$a}<=> $j{$b} } keys %j }' */*Z.xml
@haoess
haoess / gist:789552
Created January 21, 2011 11:23
XML-Elemente aus dem Dingler, die *nicht* bei der Nurtext-Fassung durch Leerraum abgetrennt werden dürfen
bibl
abbr
biblFull
biblScope
biblStruct
char
charDecl
charName
charProp
choice
@haoess
haoess / gist:786053
Created January 19, 2011 11:47
Alle XML-Elemente aus dem Dingler
ab
abbr
add
addName
author
back
bibl
biblScope
biblStruct
birth