Skip to content

Instantly share code, notes, and snippets.

@edipretoro
edipretoro / gist:2290438
Created April 3, 2012 08:27
yaz-client trace
Z> authentication Z3950 Z3950_BNF
Z> open z3950.bnf.fr:2211/TOUT-UTF8
Connecting...OK.
Sent initrequest.
Connection accepted by v3 target.
ID : DBV-OSI II UNIX API
Name : Frontal Z3950 BnF
Version: Version 1.0
Options: search present delSet scan namedResultSets
Elapsed: 0.160643
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@edipretoro
edipretoro / init.el
Last active June 19, 2023 19:32
Starting point for an Emacs configuration
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
@edipretoro
edipretoro / eml_renamer.pl
Created October 2, 2011 09:49
Rename a batch of EML files
#!/usr/bin/env perl
use strict;
use warnings;
use Email::MIME;
use File::Slurp;
use File::Next;
use DateTime::Format::Flexible;
@edipretoro
edipretoro / lis_advent_calendar-recsys.py
Created December 6, 2020 20:47
A basic recommendation system based on loans data
from math import sqrt
import json
import pathlib
import pprint
def fill_resources(patrons):
all_resources = {}
for patron in patrons:
for resource, rating in patrons[patron].items():
@edipretoro
edipretoro / unimarc2anki.py
Created June 27, 2020 19:12
Simple CLI to produce an Anki deck about UNIMARC
#!/usr/bin/env python
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, Session
from unimarc2anki.db import Field, SubField
import genanki
import random
model_id = random.randrange(1 << 30, 1 << 31)
model = genanki.Model(
@edipretoro
edipretoro / sim_unimarc_records.py
Created June 21, 2020 09:11
Simple CLI to compute similarities between bibliographic records.
#!/usr/bin/env python
"""Simple CLI to compute similarities between bibliographic records."""
from typing import Callable, Iterable, Tuple
import jellyfish as jf
import pymarc
import pathlib
import argparse
#!/usr/bin/env python
import requests
import hashlib
import json
operations_log = {}
headers = {
"Cache-Control": "no-cache",
@edipretoro
edipretoro / some_records.mrc
Last active January 30, 2017 21:25
A very minimal UTF-8 ISO2709 file containing 2 UNIMARC records
01626cam 2200349 450 001002100000003004700021010003500068020001700103073001800120100004100138101000800179102000700187105001800194106000600212200013700218210009200355215004500447225002300492300006700515300001000582410005800592606005400650676002300704686007000727700004700797701003600844701003600880702003600916801007000952930011601022930013801138FRBNF423141140000009http://catalogue.bnf.fr/ark:/12148/cb42314114d a978-2-7440-2419-1bbr.d22 EUR aFRb01102691 0a9782744024191 a20101109d2010 m y0frey50 ba0 afre aFR a||||z 00|y| ar1 aPerl modernebTexte impriméfSébastien Aperghis-Tramoni, Damien Krotkine, Jérôme Quelingavec la contribution de Philippe Bruhat aPariscPearson éducation Francedimpr. 2010e63-Clermont-FerrandgImpr. la Source d'or a1 vol. (XVIII-445 p.)ccouv. ill.d19 cm| aLe guide de survie aLa couv. porte en plus : "l'essentiel des pratiques actuelles" aIndex 0040971782tLe Guide de survie (Paris)x1955-9992d2010 312490649aPerl (langage de
@edipretoro
edipretoro / reveal.pl
Last active February 9, 2016 06:27
Tiny tool to create a webserver and serve my presentations created with Reveal.js
#!/usr/bin/env perl
use strict;
use warnings;
use Plack::Builder;
use Plack::App::Directory;
use Cwd;
my $revealjs_repository = '/Users/manu/projets/reveal.js';