Skip to content

Instantly share code, notes, and snippets.

View karkraeg's full-sized avatar
💭
👀

Karl Krägelin karkraeg

💭
👀
View GitHub Profile
@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
<!doctype html>
<html>
<head>
<title>Site Maintenance</title>
<meta charset="utf-8"/>
<meta name="robots" content="noindex"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body { text-align: center; padding: 20px; font: 20px Helvetica, sans-serif; color: #efe8e8; }
@media (min-width: 768px){
@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)
@karkraeg
karkraeg / genres.txt
Last active January 18, 2018 13:08 — forked from sampsyo/genres.txt
music genre list scraper
2 tone
2-step garage
4-beat
4x4 garage
8-bit
acapella
acid
acid breaks
acid house
acid jazz