Skip to content

Instantly share code, notes, and snippets.

View black23's full-sized avatar

black23 black23

View GitHub Profile
@black23
black23 / ModifyMARC.xsl
Last active August 29, 2015 14:22
XSLT šablona pro Koha OAI
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:marc="http://www.loc.gov/MARC21/slim"
version="1.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@* | node()">
<xsl:copy>
@black23
black23 / oaiconf.yaml
Created June 11, 2015 11:07
Nastavení OAI provideru Koha (YAML)
format:
marcxml:
metadataPrefix: marcxml
metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd
xsl_file: /home/koha/xslt/ModifyMARC.xsl
marc21:
metadataPrefix: marc21
metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd
@black23
black23 / CPK_Koha_OAI
Created July 23, 2015 11:54
Příklad šablony OAI pro CPK (996)
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:marc="http://www.loc.gov/MARC21/slim"
version="2.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@* | node()">
<xsl:copy>
# Flush the tables to apply changes
iptables -F
# Allow established connections (the responses to our outgoing traffic)
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# SSH from anywhere
iptables -A INPUT -m state --state NEW -p tcp --dport 22 -j ACCEPT
@black23
black23 / gist:2e48a946c5b247b8f076
Created December 21, 2015 08:37
Obálky z Obálek knih v OPACu Koha
/* Obálky */
var obalky = obalky || {};
obalky.protocol =
(document.location.protocol == 'https:') ? 'https://':'http://';
obalky.url = obalky.protocol+"www.obalkyknih.cz";
obalky.books = obalky.books || [];
obalky.version = "0.2.0";
obalky.id = 0;
@black23
black23 / gist:15205a9e14caf24b5c0f
Created December 21, 2015 08:42
SQL výstup na zjištení historie rezervací čtenáře
SELECT CONCAT_WS("", "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=", bor.borrowernumber, "'>", bor.firstname, " ", bor.surname, "</a>") AS "Ctenar",
oldr.reservedate AS "Datum rezervace", br.branchname AS "Knihovna",
IF(ISNULL(cancellationdate), IF(found = "F", "<span style='color:green;font-weight:bold'>Vyřízeno</span>", found), CONCAT("<span style='color:red;'>Zrušeno ", cancellationdate, "</span>")) AS "Stav",
b.author AS "Autor",
CONCAT("<a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=", b.biblionumber, "'>", b.title, "</a>") AS "Nazev",
i.stocknumber AS "P. cislo", i.barcode AS "Carovy kod", it.description AS "Typ jednotky"
FROM old_reserves oldr
JOIN borrowers bor ON oldr.borrowernumber = bor.borrowernumber
JOIN biblio b ON oldr.biblionumber = b.biblionumber
LEFT OUTER JOIN items i ON oldr.itemnumber = i.itemnumber
@black23
black23 / convert_from_tag2mrk
Created June 7, 2016 11:02
Skript v Pythonu na konverzi řádkového MARC (TAG) do formátu čitelného MarcEditem
#!/usr/bin/python27
'''
Script pro prevod souboru pro MarcEdit
'''
import string
import sys
import os
def usage():
SELECT concat('<a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=', `old_issues`.`borrowernumber`, '">', firstname, ' ', surname, '</a>') as 'Čtenář',
concat('<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=', items.biblionumber, '">', items.barcode, '</a>') as 'Jednotka',
date_format(old_issues.timestamp, "%e.%c.%Y %H:%i:%s") as 'Zpracováno'
FROM old_issues
JOIN borrowers on old_issues.borrowernumber = borrowers.borrowernumber
JOIN items ON old_issues.itemnumber = items.itemnumber
WHERE `old_issues`.`timestamp` != `old_issues`.`returndate`
AND DATE(old_issues .timestamp) = CURDATE()
ORDER BY old_issues.timestamp
SELECT count(*) as 'Počet vrácení'
FROM old_issues
JOIN borrowers on old_issues.borrowernumber = borrowers.borrowernumber
JOIN items ON old_issues.itemnumber = items.itemnumber
WHERE `old_issues`.`timestamp` != `old_issues`.`returndate`
AND DATE(old_issues .timestamp) BETWEEN <<Od|date>> AND <<Do|date>>
ORDER BY old_issues.timestamp
#!/bin/bash
INSTANCE="nazev_instance_kohy"
SIGLA="sigla_knihovny"
USERNAME="vypdilia"
PASSWORD="heslo"
YEAR=$(date "+%Y")
QUARTAL=$(echo "(`date +%m` - 1)/3" | bc)
if [ "$QUARTAL" == "0" ] ; then