Skip to content

Instantly share code, notes, and snippets.

View karkraeg's full-sized avatar
💭
👀

Karl Krägelin karkraeg

💭
👀
View GitHub Profile
# ICS aiocr Configuration File
# This file contains the prompt and JSON structure for data extraction
# Prompt
default_prompt: |
Extract the following Information of the game from the given Scans:
!!!CRITICAL: If you don't find the information dont hallucinate it, leave it empty!!!
- Title
- Subtitle
- Year of Publication (if multiple use the earlier date)
{
"aar": "aa",
"abk": "ab",
"afr": "af",
"aka": "ak",
"alb": "sq",
"amh": "am",
"ara": "ar",
"arg": "an",
"arm": "hy",
@karkraeg
karkraeg / install_collective_access.sh
Last active February 20, 2024 14:55
Installation of Collective Access Provdence on Ubuntu 22 with PHP 7.4
#!/bin/bash
sudo apt update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
# Install Apache
sudo apt install -y apache2
@karkraeg
karkraeg / german_instruments.py
Created January 8, 2023 15:52
Extract the german names of all Instruments in MIMO Dataset
import json
import requests
keywords = "https://raw.githubusercontent.com/philharmoniedeparis/mimo/master/our_data/03_skos/keywords_skos.json"
data = json.loads(requests.get(keywords).text)
instruments = []
for i in data[1:]:
for item in i["http://www.w3.org/2004/02/skos/core#prefLabel"]:
if item["@language"] == "de":
@karkraeg
karkraeg / mimo.py
Created December 19, 2022 21:16
Get german Names of Instruments from MIMO Vocabulary
import json
import requests
keywords = "https://raw.githubusercontent.com/philharmoniedeparis/mimo/master/our_data/03_skos/keywords_skos.json"
data = json.loads(requests.get(keywords).text)
instruments = []
for i in data[1:]:
for item in i["http://www.w3.org/2004/02/skos/core#prefLabel"]:
if item["@language"] == "de":
def generateZDBcheckdigit(number):
numberstr = str(number)
if len(numberstr) > 10 or len(numberstr) < 8:
print("Identnummer ohne Prüfziffer besteht aus einer Folge von minimal 8 und maximal 10 Zifern.")
else:
numberstr = numberstr.strip().zfill(10)
summe = 0
for position, n in enumerate(numberstr):
summe += (11 - position)*int(n)
pruefziffer = 11 - (11 - (summe % 11)) % 11
@karkraeg
karkraeg / csv2mediawikiXML.py
Created May 6, 2019 13:54
load a CSV file and use each lines’ content for a new Mediawiki page. Resulting XML can be imported into Mediawiki and thus batch creating wiki-pages from a CSV should work!
import pandas as pd
df = pd.read_csv('mydata.csv', sep=';')
def convert_row(row):
"""
This function creates a <page> node for each line in the CSV.
You can define variables from the CSV columns and reference them in the return statement with curly braces.
"""
Help for "import-media":
Import media from a directory or directory tree.
Options for import-media are:
--source (-s) Data to import. For files provide the path; for database, OAI and other
non-file sources provide a URL.
--username (-u) User name of user to log import against.
{
"diagnostic": {
"count": 6,
"page": 1,
"pages": 1,
"q": "soup",
"results_per_page": 20
},
"records": [
{
@karkraeg
karkraeg / IconclassAPI.py
Created August 2, 2017 14:16
Query Iconclass API and output all found records with URI, German description and URL.
# -*- coding: utf-8 -*-
import json
import requests
import urllib2
kw = 'soup'
requestURL = 'http://iconclass.org/rkd/9/?q=' + kw + '&q_s=1&fmt=json'
cjson = urllib2.urlopen(requestURL)