Skip to content

Instantly share code, notes, and snippets.

@ssp
ssp / commands.sh
Last active November 28, 2018 22:20
# alle Dateien, deren Name auf _B endet …
find . -name "*_B" -print0 | xargs -0 ./reduce.py > processed.csv
# erster Versuch mit Pipes
cat 20181011_06-04-51_B \
| awk 'NR == 1 || NR == 2 || NR % 100 == 0' \
| sed -e 's/ \+/ /g' \
| cut -d ' ' -f 1-10 \
@ssp
ssp / pazpar2-curl.sh
Created January 24, 2012 20:22
curl commands for starting a pazpar2 session, searching and querying results
#!/usr/bin/env sh
curl "http://vlib.sub.uni-goettingen.de/pazpar2/search.pz2?command=init&service=vlib" | grep init | sed -e 's/.*<session>//' | sed -e 's/<\/session>.*//' > /tmp/sessionID ; curl "http://vlib.sub.uni-goettingen.de/pazpar2/search.pz2?command=search&query=gaga&session=`cat /tmp/sessionID`" ; curl "http://vlib.sub.uni-goettingen.de/pazpar2/search.pz2?command=show&session=`cat /tmp/sessionID`" ; curl "http://vlib.sub.uni-goettingen.de/pazpar2/search.pz2?command=show&session=`cat /tmp/sessionID`" ; curl "http://vlib.sub.uni-goettingen.de/pazpar2/search.pz2?command=show&session=`cat /tmp/sessionID`" ; curl "http://vlib.sub.uni-goettingen.de/pazpar2/search.pz2?command=show&session=`cat /tmp/sessionID`" ; curl "http://vlib.sub.uni-goettingen.de/pazpar2/search.pz2?command=show&session=`cat /tmp/sessionID`" ; curl "http://vlib.sub.uni-goettingen.de/pazpar2/search.pz2?command=show&session=`cat /tmp/sessionID`" ; curl "http://vlib.sub.uni-goettingen.de/pazpar2/search.pz2?command=show&session=`cat /tmp/se
@ssp
ssp / emf-converter.sh
Created November 13, 2012 14:54
Convert Windows EMF to usable graphics files with a crazy chain of tools.
#! /bin/sh
# Convert Windows EMF to usable graphics files with a crazy chain of tools.
# 2012 Sven-S. Porst, SUB Göttingen <porst@sub.uni-goettingen.de>
# Configuration
BASEPATH=/Users/ssp/SUB/edfu/emf
WINE=wine
METAFILE2EPS=$BASEPATH/metafile2eps-linux/metafile2eps.exe
PS2PDF=ps2pdf
INKSCAPE=/Applications/Graphik/Inkscape.app/Contents/Resources/bin/inkscape
@ssp
ssp / ParseURIs.java
Last active November 18, 2016 22:26
Dauert das Parsen von URIs lange?
package net.earthlingsoft.uritest;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
@ssp
ssp / clone-and-build-gitx.sh
Last active November 1, 2016 15:00
Script to clone and build gitx
#!/usr/bin/env sh
#
# Script to clone gitx from github and build it using
# the scripts provided by the project.
#
# Sven-S. Porst @ssp <ssp-web@earthlingsoft.net>
#
git clone https://github.com/ssp/gitx.git
cd gitx
input {
stdin {
type => "stdin-type"
}
file {
type => "apache"
path => ["/var/log/apache2/access_log", "/var/log/apache2/error_log", "/var/log/apache2/ssl_request_log"]
}
@ssp
ssp / Wikidata.sparql
Last active May 26, 2016 21:40
Colours from Wikidata/dbpedia
SELECT ?color ?label (lang(?label) AS ?language) ?rgb WHERE {
?color wdt:P31/wdt:P279* wd:Q1075. # instance or subclass of »colour«
?color wdt:P465 ?rgb. # store sRGB value in ?rgb
?color rdfs:label ?label. # store label in ?label
FILTER (lang(?label)="de" || lang(?label) = "en" || lang(?label) = "fr" || lang(?label) = "tr")
}
ORDER BY ASC(?rgb)
@ssp
ssp / check-codesign-running.sh
Last active April 19, 2016 20:21
One-liner to check all running processes on Mac OS X with codesign.
#!/usr/bin/env sh
ps aux | cut -b 16-22 | sed -e "s/\s*//" | grep -v PID | sort -n | xargs -n 1 -IA sh -c "codesign --verify --deep A"
@ssp
ssp / cookiekiller.py
Created March 7, 2010 15:30
Kill bad cookies in WebKit. Uses poor and incomplete heuristics to achieve its goal. Includes a LaunchAgent to run the script every night (path in that must be adapted for your account).
#!/usr/bin/env python
"""
COOKIE KILLER
2010 by Sven-S. Porst <ssp-web@earthlingsoft.net>
Script with simple heuristics to kill the most obviously crap cookies in WebKit.
Available at http://gist.github.com/324414
Better quit cookie users before running the script.
@ssp
ssp / zvdd-sru.text
Created December 16, 2013 15:19
Example for the output formats of the ZVDD SRU interface
This file has been truncated, but you can view the full file.
Z> find Hilbert
Received SRW SearchRetrieve Response
Number of hits: 8414
Elapsed: 0.021573
Z> schema dc
Z> s 1
Received SRW SearchRetrieve Response
Number of hits: 8414
pos=1 schema=dc
<record xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:srw_dc="info:srw/schema/1/dc-schema">