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 | |
class Deduplicator | |
{ | |
protected $items = []; | |
public function add($item) | |
{ | |
// name field will be in $item->name | |
$this->items[] = $item; | |
} |
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
#!/usr/bin/env php | |
<?php | |
/* | |
* @param float $p should be 0= < $p <= 1 | |
* @return 1 with probability $p, 0 with probability (1 - $p) | |
*/ | |
function bernoulli($p) { | |
$r = mt_rand() / mt_getrandmax(); |
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
PS1='\u@\h:\w\[\033[32m\]$(__git_ps1)\[\033[0m\]$ ' |