Skip to content

Instantly share code, notes, and snippets.

View pyrou's full-sized avatar

⭐️ Michael pyrou

View GitHub Profile
@pyrou
pyrou / index.php
Created May 27, 2015 09:54
Run a php server if file launched from CLI (from PayPal-PHP-SDK)
<?php
if (PHP_SAPI == 'cli') {
// If the index.php is called using console, we would try to host
// the built in PHP Server
if (version_compare(phpversion(), '5.4.0', '>=') === true) {
//exec('php -S -t ' . __DIR__ . '/');
$cmd = "php -S localhost:5000 -t " . __DIR__;
$descriptors = array(
0 => array("pipe", "r"),
#!/usr/bin/python
# Modified by Travis Lee
# -changed output to display text only instead of hexdump and made it easier to read
# -added option to specify number of times to connect to server (to get more data)
# -added option to specify TLS version
# -added option to send STARTTLS command for use with SMTP/POP/IMAP/FTP/etc...
# -added option to specify an input file of multiple hosts, line delimited, with or without a port specified (host:port)
# -added option to have verbose output
# -added capability to automatically check if STARTTLS/STLS/AUTH TLS is supported when smtp/pop/imap/ftp ports are entered and automatically send appropriate command