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
<?php | |
// run all the tests | |
abstract class TestSuite { | |
public function __construct() { | |
$ref = new ReflectionClass($this); | |
$methods = $ref->getMethods(ReflectionMethod::IS_PUBLIC); | |
$output = ''; | |
foreach ($methods as $method) { | |
if ($method->getDeclaringClass() == $ref) { |
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
#!/bin/bash | |
domain=$1 | |
origin="example-origin.net" | |
file=/etc/hosts | |
fqdn= | |
if [ $# -lt 1 ]; then | |
echo "Usage: $(basename "$0") DOMAIN [{production|staging|origin|off}]" >&2 | |
exit 1 |
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
#!/bin/bash | |
if [ $# -lt 1 ]; then | |
echo "Usage: $(basename "$0") DOMAIN [ALTERNATIVES]..." >&2 | |
exit 1 | |
fi | |
# first arugment is the CN | |
domain=${1//\*/wild} | |
config="$domain.cnf" |
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
# Round to the nearest multiple of "size" | |
function bucket(a) { | |
return int((a + (size/2)) / size) * size; | |
} | |
{ buckets[bucket($1)]++ } | |
END { | |
for (b in buckets) { | |
print b, buckets[b] |
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
<html> | |
<body> | |
<script id="script"> | |
var window = { | |
location: { | |
hostname: 'malicious site' | |
} | |
}; | |
alert(window.location.hostname); |
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
#!/bin/bash | |
domain=$1 | |
[[ $domain != *":"* ]] && domain="$domain:443" | |
openssl s_client -connect $domain 2>/dev/null </dev/null \ | |
| openssl x509 -noout -text \ | |
| grep -A1 'Subject Alternative Name:' \ | |
| awk 'BEGIN{RS=",";FS=":"}{print $NF}' |
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
<html> | |
<head> | |
<script> | |
document.addEventListener('keypress', function (e) { | |
if (e.charCode == 13) { | |
document.body.classList.add('flash'); | |
document.querySelector('.warning').innerText = 'Bye bye thing!'; | |
var a = new Audio('http://soundbible.com/mp3/Woop%20Woop-SoundBible.com-198943467.mp3'); | |
a.play(); | |
a.addEventListener('ended', function() { |
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
<?php | |
$token = $_SERVER['HTTP_AUTHORIZATION']; | |
$slug = urlencode($_SERVER['HTTP_X_TRAVIS_REPOSITORY']); | |
$ch = curl_init(); | |
curl_setopt_array($ch, [ | |
CURLOPT_URL => "https://api.travis-ci.org/repo/$slug/requests", | |
CURLOPT_POSTFIELDS => json_encode([ | |
'request' => [ |
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
let maxConsumption = 0; | |
process.nextTick(() => { | |
let memUsage = process.memoryUsage(); | |
if (memUsage.rss > maxConsumption) { | |
maxConsumption = memUsage.rss; | |
} | |
}); | |
process.on('exit', () => { |