Skip to content

Instantly share code, notes, and snippets.

Magnus Enger MagnusEnger

Block or report user

Report or block MagnusEnger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sha512.t
#!/usr/bin/perl
use Digest::SHA qw( sha512_hex );
use Test::More;
use Modern::Perl;
use utf8;
my $digest1 = uc sha512_hex( 'The quick brown fox jumps over the lazy dog' );
my $truth1 = '07E547D9586F6A73F73FBAC0435ED76951218FB7D0C8D788A309D785436BBB642E93A252A954F23912547D1E8A3B5ED6E1BFD7097821233FA0538F3DB854FEE6';
is( $digest1, $truth1, 'Fox OK' );
@MagnusEnger
MagnusEnger / dvd.pl
Created Sep 6, 2016
Simple script to turn CSV records into MARCXML, using Catmandu
View dvd.pl
#!/usr/bin/perl
# Copyright 2015 Magnus Enger Libriotech
=head1 NAME
dvd.pl - Turn CSV into MARC.
=head1 SYNOPSIS
View .vimrc
" .vimrc for Magnus Enger
" Show line numbers
set number
" Turn on syntax highlighting
syntax on
" Indentation
set expandtab
@MagnusEnger
MagnusEnger / ingest.pl
Created Apr 10, 2014
Catmandu Atom ingest v2
View ingest.pl
#!/usr/bin/perl
use Catmandu::Importer::Atom;
use Catmandu::Store::ElasticSearch;
use Data::Dumper;
use Modern::Perl;
my $feed = 'http://planet.code4lib.org/atom.xml';
# Set up importer and store
@MagnusEnger
MagnusEnger / ingest.pl
Created Apr 10, 2014
Catmandu Atom ingest v1
View ingest.pl
#!/usr/bin/perl
use Catmandu::Importer::Atom;
use Catmandu::Store::ElasticSearch;
use Data::Dumper;
use Modern::Perl;
my $feed = 'http://planet.code4lib.org/atom.xml';
my $importer = Catmandu::Importer::Atom->new( url => $feed );
@MagnusEnger
MagnusEnger / tab2marc.pl
Created Apr 2, 2014
Tab separated to MARC via Catmandu
View tab2marc.pl
#!/usr/bin/perl
# Copyright 2013 Magnus Enger Libriotech
=head1 NAME
tab2marc.pl - Convert some tab-delimited data to MARCXML.
=head1 SYNOPSIS
View gist:9183729
<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
@MagnusEnger
MagnusEnger / catmandu_marc2rdf.pl
Last active Dec 29, 2015
Converting MARC to RDF, using Catmandu.
View catmandu_marc2rdf.pl
#!/usr/bin/perl
use Catmandu::Importer::MARC;
use Catmandu::Exporter::RDF;
use Modern::Perl;
my $records = Catmandu::Importer::MARC->new(
file => 'sample_records.marcxml',
type => 'XML',
);
@MagnusEnger
MagnusEnger / get_syspref.sh
Created Oct 30, 2013
This script is based on the commands made available by a package installation of Koha. It takes the name of a syspref as its argument, then prints the value of that syspref for every Koha instance on the server.
View get_syspref.sh
#!/bin/bash
# Check that the user is root
if [ "$(whoami)" != "root" ]; then
echo "Sorry, you are not root."
exit 1
fi
die() {
echo "$@" 1>&2
@MagnusEnger
MagnusEnger / gist:5925789
Created Jul 4, 2013
kete_backgroundrb_and_zebra_boot
View gist:5925789
#!/bin/bash
### BEGIN INIT INFO
# Provides: kbzb
# Required-Start: $mysql $all
# Required-Stop: $mysql
# Default-Start: 2
# Default-Stop:
# Short-Description: Reboot all Backgroundrb and Zebra for Kete instances
### END INIT INFO
You can’t perform that action at this time.