Skip to content

Instantly share code, notes, and snippets.


Stefan stefanschmidt

View GitHub Profile
stefanschmidt /
Created May 24, 2015
Convert from EPUB to PDF format
# depends on Calibre (
# the CSS snippet prevents images from filling the page
# adapt margins, page size and font size as needed
ebook-convert doc.epub doc.pdf \
--smarten-punctuation \
--pretty-print \
--preserve-cover-aspect-ratio \
--insert-blank-line \
--margin-top 60 \
--margin-left 60 \
stefanschmidt /
Created Apr 12, 2016
Fix ownership and permissions of a multi-user Homebrew installation
# fix owner of files and folders recursively
sudo chown -vR $(whoami) /usr/local /opt/homebrew-cask /Library/Caches/Homebrew
# fix read/write permission of files and folders recursively
chmod -vR ug+rw /usr/local /opt/homebrew-cask /Library/Caches/Homebrew
# fix execute permission of folders recursively
find /usr/local /opt/homebrew-cask /Library/Caches/Homebrew -type d -exec chmod -v ug+x {} +
stefanschmidt /
Last active Aug 8, 2020
Remove all annotations from a PDF document
pdftk original.pdf output uncompressed.pdf uncompress
LANG=C sed -n '/^\/Annots/!p' uncompressed.pdf > stripped.pdf
pdftk stripped.pdf output final.pdf compress
stefanschmidt /
Last active Jul 18, 2020
Show all third party extensions on OS X (From forum posting by Linc Davis)
# Show all thirdparty kernel extensions
kextstat -kl | awk '!/com\.apple/ {print $6 $7}'
# Show all thirdparty launch services (root)
sudo launchctl list | sed 1d | awk '!/0x|com\.apple/ {print $3}'
# Show all thirdparty launch services (user)
launchctl list | sed 1d | awk '!/0x|com\.apple/ {print $3}'
# Show all extensions in the library folders
stefanschmidt /
Last active Jul 13, 2020
Completely Uninstall Parallels Desktop 7 on OS X 10.8 (Mountain Lion)
# Unload all Parallels kernel extensions
for kext in $(kextstat | grep parallels | awk '{print $6}'); do kextunload -v 1 -b $kext; done
# Delete all Parallels kernel extensions
rm -v /System/Library/Extensions/prl*
# Delete all other Parallels files
rm -vr \
/Applications/Parallels\ \
/Library/Parallels/Parallels\ \
stefanschmidt /
Created Aug 27, 2013
Stop Dropbox from asking for admin password after installation to ~/Applications
chmod 0000 ~/Applications/*.tgz
stefanschmidt / toggle-screen-sharing
Last active May 18, 2020
Enable/Disable Screen Sharing on OSX
View toggle-screen-sharing
# Enable Screen Sharing
sudo launchctl load -w /System/Library/LaunchDaemons/
# Disable Screen Sharing
sudo launchctl unload -w /System/Library/LaunchDaemons/
stefanschmidt / osx-software-update-urls.txt
Created Jan 4, 2014
URLs of the index files used by the software update client on OS X
View osx-software-update-urls.txt
10.3 (Panther):
10.4 (Tiger):
10.5 (Leopard):
10.6 (Snow Leopard):
10.7 (Lion):
10.8 (Mountain Lion):
10.9 (Mavericks):
10.9 (Mavericks incl. seeds):
stefanschmidt /
Last active Apr 7, 2019
Generate salted SHA-512 hashes
# Using mkpasswd and slappasswd we will generate salted SHA-512 hashes
# password: secret
# method 1: using mkpasswd
# requires whois package on Ubuntu
mkpasswd --method=sha-512 --salt=foobar42
# method 2: using slappasswd
# requires slapd package on Ubuntu
stefanschmidt /
Last active Apr 7, 2019
Authenticate via LDAP on the command line
# Using an LDAP test server we will authenticate the user newton
# method 1: using ldapwhoami
# should return "Result: Success (0)" if authentication was successful
ldapwhoami -vvv -h -D "uid=newton,dc=example,dc=com" -x -w password
# method 2: using ldapsearch
# should return "result: 0 Success" if authentication was successful
ldapsearch -h -x -D uid=newton,dc=example,dc=com -w password -b "dc=example,dc=com" "(uid=newton)"
You can’t perform that action at this time.