Skip to content

Instantly share code, notes, and snippets.

<?php
// This exitcode means the alarm handler of the parent process killed the child
define ('EXITCODE_PARENT_INTERVENED', 0); // MUST be 0
// This exitcode means the child achieved the second lock. That'd be weird.
define ('EXITCODE_LOCK_ACHIEVED', 1);
// This exitcode means the second lock got interrupted (and returned false).
define ('EXITCODE_LOCK_INTERRUPTED', 2);
@mathieuk
mathieuk / example_run.txt
Last active March 24, 2016 16:00
Two files used to try and test for weakness of openssl_random_pseudo_bytes().
$ php test.php 1>log
New process: 10500 16:44:52
New process: 11000 16:44:55
New process: 11500 10:00:02
New process: 12000 10:00:02
New process: 12500 10:00:02
New process: 13000 16:45:06
New process: 13500 10:00:02
New process: 14000 10:00:02
[... snipped for brevity ...]
@mathieuk
mathieuk / gist:1141556
Created August 12, 2011 06:13
Bash autocompletion function for the 'phpunit --filter' command.
shopt -s progcomp
_testnames()
{
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--filter"
if [[ $cur == -* || $prev == -* ]]; then