Skip to content

Instantly share code, notes, and snippets.

View ckressibucher's full-sized avatar

Claudio Kressibucher ckressibucher

View GitHub Profile
@ckressibucher
ckressibucher / check_expiration.sh
Created December 21, 2019 13:18
check expiration date of TLS certificate
#!/bin/bash
hostname=$1
expire_str=$(true | openssl s_client -connect $hostname:443 2>/dev/null | openssl x509 -noout -enddate | cut -d = -f2)
expire=$(date -d "$expire_str" +%s)
current=$(date +%s)
secs_left=$(expr $expire - $current)
days_left=$(expr $secs_left / 3600 / 24)
@ckressibucher
ckressibucher / cliserver.php
Last active November 10, 2023 17:58
Router script for PHP built in server
<?php
// public/cliserver.php (router script)
if (php_sapi_name() !== 'cli-server') {
die('this is only for the php development server');
}
if (is_file($_SERVER['DOCUMENT_ROOT'].'/'.$_SERVER['SCRIPT_NAME'])) {
// probably a static file...
return false;