Skip to content

Instantly share code, notes, and snippets.

@tschloss
tschloss / gist:5982926
Last active February 24, 2020 05:02
# Xing-Scraper ## Description Scrapes the contact list of a contact (visible page) to CouchDB Works on the "Kontakte" Tab of a contact (if contacts are deiplayed by policy) This version scrapes only the 10 contacts visible, the next version will skip to the next page until last page has been reached ## Prerequisites: 1. This Javascript code has …
// ==UserScript==
// @name Xing-Scraper
// @namespace http://use.i.E.your.homepage/
// @version 0.95
// @description scrapes the contact list of a contact (visible page) to CouchDB
// @match https://www.xing.com/app/profile*
// @copyright 2012+, You
// ==/UserScript==
// Works on the "Kontakte" Tab of a contact (if contacts are deiplayed by policy)
@tschloss
tschloss / cal3.py
Created August 12, 2013 00:03
Python script that prints a 3-month calendar (previous, current, next month) WITH calendar weeks. The current day is highlighted. No parameters currently. INTENDED USE: Geeklet for Geek-Tool.
import calendar
import datetime
import time
now = time.localtime()
curj=now[0] if now[1]>1 else now[0]-1 #2013
curm=now[1]-1 if now[1]>1 else 12 #8
for i in range(3,0,-1):
kw=datetime.date(curj, curm, 1).isocalendar()[1]
@tschloss
tschloss / gist:ac6fd9bb60e9dc18e318ef6df1fe2a35
Last active May 23, 2021 13:59
Golf World Handicap System > print table handicap-index:playing-handicap
#!/usr/bin/env python3
# Purpose:
# Golf > print table handicap-index:playing-handicap
# range of indexes: 0..36.0
# handicaps should be negative, the display is *(-1)
# Author: Thomas Schlosser, [email protected]
cr = 72.5
slope = 130
par = 72
# 0 means 'no result', 'strich'
# two input methods: by player and by hole - both are evaluated together. Use "by-hole" for own flight, "by-player" for other flights
# Disclaimer: The code quality is very low. All the rules are hard coded. No UI.
inputByPlayer = '555654676 Willy 17,663664666 Cengiz 30' #'583765585 Peter 16,575785474 Cengiz 30,563653575 Rainer 13,584554566 Hans 21'
inputByHole = 'Thomas Peter Horst,10 16 28,447 667 350 555 575 533 485 576 746'
coursepar18 = [4,5,3,4,4,3,4,5,4,4,4,4,3,5,4,3,5,4]
# [4,5,4,4,3,5,3,4,4,4,4,3,5,4,5,3,4,4] # GC Pfalz
@tschloss
tschloss / umbenennen.sh
Created November 26, 2021 17:30
Rename a batch of PDFs by keywords found in the text (very specific)
#!/bin/bash
### MacOS (sollte auch auf Linux laufen)
### Es wird ein Tool benötigt. welches PDF on Text umwandelt, hier "pdftotext"
### ... man muss sich den Output anschauen und sehen, wie man den namensgebenden Text findet
### ... hier sind es drei Stellen, die ich suche und in ein CSV schreibe sowie die Datei umbenenne
### ... Sondernehandlung für PDFs, die die Schlüsselwörter nicht enthalten => dann Werte des vorigen PDFs übernehmen
#rm log
schluessel="FEHLER"
aahed
aalii
aalst
aalto
aamsi
aapss
aarau
aaren
aargh
aaron