Skip to content

Instantly share code, notes, and snippets.

View dahelg's full-sized avatar
:octocat:

Helge Drews dahelg

:octocat:
View GitHub Profile
@dahelg
dahelg / replace_umlaute.py
Last active September 3, 2020 19:57 — forked from frruit/replace_umlaute.py
Small example hot to convert german special characters from unicode to utf-8 and back to unicode
# Small example how to convert german special characters from unicode to utf-8 and back to unicode
# http://www.utf8-zeichentabelle.de/unicode-utf8-table.pl?start=128&number=128&names=-&utf8=string-literal
#
umlaute_dict = {
'\xc3\xa4': 'ae', # U+00E4 \xc3\xa4
'\xc3\xb6': 'oe', # U+00F6 \xc3\xb6
'\xc3\xbc': 'ue', # U+00FC \xc3\xbc
'\xc3\x84': 'Ae', # U+00C4 \xc3\x84
'\xc3\x96': 'Oe', # U+00D6 \xc3\x96
@dahelg
dahelg / LdapAuth.java
Last active December 19, 2017 12:20 — forked from jbarber/LdapAuth.java
LDAP example for searching and simple binding (authentication)
/*
* First create the keystore (to allow SSL protection) by importing the LDAP
* certificate (cert.pem) with:
* keytool -import -keystore keystore -storepass changeit -noprompt -file cert.pem
*
* You can get the certificate with OpenSSL:
* openssl s_client -connect ldap.server.com:636 </dev/null 2>/dev/null | sed -n '/^-----BEGIN/,/^-----END/ { p }' > cert.pem
*
* Then compile this class with:
* javac LdapAuth.java