Skip to content

Instantly share code, notes, and snippets.

View cneud's full-sized avatar
🐙

Clemens Neudecker cneud

🐙
View GitHub Profile
@cneud
cneud / sbb.api.doc.md
Last active October 8, 2018 16:52
SBB API docs

APIs of the Staatsbibliothek zu Berlin - Preußischer Kulturbesitz*

*(to the extent currently implemented)

Programmatic access to the digitised collections and digitised newspapers of the Staatsbibliothek zu Berlin - Preußischer Kulturbesitz (SBB) is currently possible via two distinct APIs.

Retrieval of metadata for objects in the digitised collections is established by use of the The Open Archives Initiative Protocol for Metadata Harvesting (OAI-PMH) standard. A wide range of client applications for OAI-PMH in numerous programming languages are freely available on the web.

The base URL for the OAI-PMH endpoint of the digitised collections of the SBB is

@cneud
cneud / index.html
Last active June 15, 2017 14:26
DFG Zeitungsdigitalisierung Wegweiser Workflow interaktiv
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name=viewport content="width=device-width, initial-scale=1">
<title>Digitalisierung historischer Zeitungen</title>
<style type="text/css">body,button{font-family:Verdana}.tooltip,button{display:inline-block}body{margin:auto;width:90%}p{text-align:justify}button{background-color:#fff;color:#000;width:185px;border:2px solid #87CEEB;padding:16px 32px;margin-left:32px;text-align:center;text-decoration:none;font-size:16px;border-radius:12px;-webkit-transition-duration:.4s;transition-duration:.4s}button:focus,button:hover{background-color:#87CEEB;outline:0!important;color:#fff}.container{width:100%;margin:0 auto}.frame{margin:0 auto;width:1120px;background-color:white}.left_column{float:left;width:23%}.right_column{background-color:#F0F0F0;float:left;width:71%;text-align:left;padding-left:10px;padding-right:10px}.header{text-align:center}.footer{text-align:right;clear:both}.code{font-family:Courier}.tooltip{position:relative;border-bottom:1px

Keybase proof

I hereby claim:

  • I am cneud on github.
  • I am cneud (https://keybase.io/cneud) on keybase.
  • I have a public key ASAd6dmUN_e1NQBj1wzhFDYI1KdDf5APrXq83uxsdqiWMwo

To claim this, I am signing this object:

@cneud
cneud / fix_sbb.sh
Created March 16, 2016 16:06
Fix for issues with corrupted files and wrong file locations in SBB newspapers
#!/bin/bash
echo "\nCreating missing directories for SBB_NAZ\n"
mkdir SBB_NAZ/1930/
mkdir SBB_NAZ/1929/
mkdir SBB_NAZ/1928/
mkdir SBB_NAZ/1927/
mkdir SBB_NAZ/1926/
mkdir SBB_NAZ/1925/
mkdir SBB_NAZ/1925/
mkdir SBB_NAZ/1924/
@cneud
cneud / traverse_dir_python_call.bat
Created February 17, 2016 12:44
Recursively traverse dirs & call Python program
FOR /R %%a IN (*.foo) DO python foo.py "%%a" > "%%~dpna.foo"
@cneud
cneud / XMLtoJSON.js
Last active August 29, 2015 14:17
XML to JSON converter function
// Converts XML to JSON
// from: http://coursesweb.net/javascript/convert-xml-json-javascript_s2
function XMLtoJSON() {
var me = this; // stores the object instance
// gets the content of an XML file and returns it in
me.fromFile = function(xml, rstr) {
// Creates an instance of a XMLHttpRequest object
var xhttp = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
// sets and sends the request for calling "xml"
@cneud
cneud / cluster-up.sh
Last active June 11, 2017 12:23
Bash script containing all steps required to fire up a CDH cluster
#!/bin/bash
# Hadoop cluster start-up script
#
# 1. Format the namenode (only required on 1st start!)
# sudo -u hdfs hdfs namenode -format
# 2. Start HDFS
for x in `cd /etc/init.d ; ls hadoop-hdfs-*` ; do sudo service $x start ; done
# 3. Create the /temp directory
@cneud
cneud / rename.rb
Created April 18, 2014 16:13
Ruby script for recursively renaming files and directories
#!/usr/bin/ruby
def rename(dir, map)
Dir.foreach(dir) do |filename|
next if filename =~ /^\.+$/ or File.directory?("#{dir}/#{filename}")
(entry, extension) = filename.sub("file", "").split(".")
entry.sub!(/^0+/, "")
if map[entry].nil?
raise "PROBLEM: no entry for file #{dir}/#{filename} with id #{entry}"
else
@cneud
cneud / csv2list.bsh
Created April 18, 2014 16:05
Beanshell for csv -> list conversion
List leftList = new ArrayList();
List rightList = new ArrayList();
String[] lines = csv.split("\n");
for(line : lines) {
String[] urls = line.split("\"");
leftList.add(urls[1]);
rightList.add(urls[3]);
}
@cneud
cneud / levenshtein.bsh
Created April 18, 2014 16:02
Beanshell for calculating Levenshtein distance of two input strings
import org.apache.commons.lang.StringUtils;
import java.text.DecimalFormat;
double ld = StringUtils.getLevenshteinDistance(text1, text2);
double avglen = ((double)text1.length()+(double)text2.length())/2.0;
double m = 1.0-(ld/avglen);
double normVal = (m<0)?0.0:m;
float f = (float) normVal * 100;
DecimalFormat s = new DecimalFormat("##.##");
normalized_levenshtein_distance = s.format(f);