Skip to content

Instantly share code, notes, and snippets.

View MagnusEnger's full-sized avatar

Magnus Enger MagnusEnger

View GitHub Profile
@MagnusEnger
MagnusEnger / gist:9183729
Created February 24, 2014 08:14
Minimal HTML5 doc
<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
@MagnusEnger
MagnusEnger / ingest.pl
Created April 10, 2014 13:46
Catmandu Atom ingest v1
#!/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 / ingest.pl
Created April 10, 2014 13:47
Catmandu Atom ingest v2
#!/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 / .vimrc
Last active August 29, 2015 14:09
.vimrc
" .vimrc for Magnus Enger
" Show line numbers
set number
" Turn on syntax highlighting
syntax on
" Indentation
set expandtab
@MagnusEnger
MagnusEnger / linesort.pl
Created October 21, 2011 11:01
Read through a file and pick out lines that contain one of a number of "trigger" strings. Print the lines grouped by the string they matched, then print the remaining lines.
#!/usr/bin/perl -w
# Read through a file and pick out lines that contain one of a number of
# "trigger" strings. Print the lines grouped by the string they matched, then
# print the remaining lines.
#
# Usage: linesort.pl myfile.txt
use File::Slurp;
use Array::Each qw( rewind );
@MagnusEnger
MagnusEnger / phosort.sh
Created October 23, 2011 19:15
Sort pictures into year/month/date folders based on the filename yyyymmdd_x.jpg
#!/bin/bash
# Read a directory of image files with names on this form:
# 20110113_001.jpg
# 20110113_002.jpg
# 20110113_003.jpg
#
# Create folders as needed and move the images into them, in this way
# 2011
# |__01
@MagnusEnger
MagnusEnger / koha-cover.sh
Created February 28, 2012 11:01
Generate and publish test coverage reports for Koha with Devel::Cover and App::ArchiveDevelCover
#!/bin/bash
cd /home/user/kohaclone
git checkout master
git pull
export PERL5LIB=/home/user/kohaclone; export KOHA_CONF=/home/user/koha-dev/etc/koha-conf.xml
export HARNESS_PERL_SWITCHES=-MDevel::Cover
prove -l
cover
archive_devel_cover.pl --from cover_db/ --to /var/www/coverage_reports/koha/
@MagnusEnger
MagnusEnger / marctt.pl
Created September 4, 2012 10:32
POC for using Template Toolkit to display MARC data
#!/usr/bin/perl
use MARC::Batch;
use Template;
use Modern::Perl;
my $batch = MARC::Batch->new('USMARC', 'test.mrc');
my $record = $batch->next();
# Set up Template Toolkit
@MagnusEnger
MagnusEnger / gist:5925789
Created July 4, 2013 08:05
kete_backgroundrb_and_zebra_boot
#!/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
@MagnusEnger
MagnusEnger / catmandu_marc2rdf.pl
Last active December 29, 2015 10:39
Converting MARC to RDF, using Catmandu.
#!/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',
);