This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# x-mpc console MPD client | |
# 1. shows history of played tracks | |
# useful for streams where history is not visible in regular clients | |
# 2. allows bookmarking favourite tracks by saving them to a file | |
fav=${MPD_FAV:-"$HOME/.mpd.fav"} | |
jobs=() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Autodetect if SSL/TLS is used by having a look at the first incoming bytes | |
* This technique is from http://webview.jabberd.org/cgi-bin/viewvc.cgi/trunk/jadc2s/clients.cc?view=markup | |
* | |
* used heuristic: | |
* - an incoming connection using SSLv3/TLSv1 records should start with 0x16 | |
* - an incoming connection using SSLv2 records should start with the record size | |
* and as the first record should not be very big we can expect 0x80 or 0x00 (the MSB is a flag) | |
* - everything else is considered to be unencrypted | |
*/ |