This file contains 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
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key | |
# Don't add passphrase | |
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub | |
cat jwtRS256.key | |
cat jwtRS256.key.pub |
This file contains 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
<?php | |
function cidr_match($ip) { | |
foreach(file('https://www.cloudflare.com/ips-v4') as $cidr) { | |
list($subnet, $mask) = explode('/', $cidr); | |
if ((ip2long($ip) & ~((1 << (32 - $mask)) - 1) ) == ip2long($subnet)) { | |
return true; |
This file contains 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
function get_smc_dnt() { | |
/* | |
* Do Not Track for privacy. | |
* When this feature is enabled, webpage should exclude all tracking tools, | |
* like Google Analytic and advertising networks | |
*/ | |
// returns TRUE if DNT is on and is equal to 1, | |
// returns FALSE if DNT is unset OR not equal to 1 | |
return (isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] == 1); | |
} |