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 DoveadmAuth { | |
public static function auth($username, $password) { | |
$descriptors = array( | |
0 => array('pipe', 'r'), | |
1 => array('pipe', 'w'), | |
2 => array('pipe', 'w'), | |
); | |
$cwd = sys_get_temp_dir(); |
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 | |
$dom = new DOMDocument(); | |
// cache of the wikipedia page | |
$dom->loadHTML(file_get_contents('abe.vigoda_cache.html')); | |
foreach($dom->getElementById('persondata')->getElementsByTagName("tr") as $row) { | |
foreach($row->childNodes as $node) { | |
if( $node->hasAttribute('class') ) { | |
var_dump($dom->saveXML($node)); | |
} |
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 | |
require('creds.php'); | |
if( isset($creds[$_POST['user']]) && ($creds[$_POST['user']] == md5($_POST['pass'])) ) { | |
echo "Authenticated"; | |
} else { | |
echo <<<_eoi_ | |
<form action="" method="POST"> | |
<input name="user" type="text" /> | |
<input name="pass" type="password" /> |
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
hello friend | |
i am not a registered investment advisor but there is a stock alert that i think is a strong buy | |
you can get unclaimed prizes from oprah! sometimes viagra or cialis or vicodin | |
enlarge whanger with money back guarantee even if you have poor credit for low price with no medical exam | |
sincerely, your trusted friend | |
captain tin-encapsulated ham-like product |
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 get_last_lines($file, $lines, $as_array=false, $desired_endl="\n", $blocksize=1024) { | |
$buffer = ''; | |
if( ! $fh = fopen($file, 'r') ) { die('could not open file'); } | |
fseek($fh, ($blocksize * -1) - 1, SEEK_END); | |
while(true) { | |
$buffer = fread($fh, $blocksize) . $buffer; | |
if( preg_match_all("/\n/", $buffer, $trash) > $lines) { | |
break; |
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
input { | |
lumberjack { | |
type => "postfix" | |
port => 6782 | |
ssl_certificate => "/opt/logstash/etc/server.crt" | |
ssl_key => "/opt/logstash/etc/server.key" | |
} | |
} | |
output { |
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
{ | |
"network": { | |
"servers": [ "loki-test-01.iad.company.com:6782" ], | |
"ssl ca": "/etc/logstash-forwarder/ca.crt", | |
"timeout": 15 | |
}, | |
"files": [ | |
{ | |
"paths": [ "/usr/local/psa/var/log/maillog" ], | |
"fields": { "type": "postfix" } |
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
chef > ::File.exists?(node['c_elk']['logstash']['extra_conf_dir']+'/server.crt') | |
=> true | |
chef > ssl_defaults = node['c_elk']['logstash']['ssl_subj_defaults'] | |
=> {"C"=>"CA", "ST"=>"BC", "L"=>"City", "O"=>"Company", "OU"=>"IT", "emailAddress"=>"servers@company.com"} | |
chef > ssl_subject = sprintf('/C=%s/ST=%s/L=%s/O=%s/OU=%s/CN=%s/emailAddress=%s', | |
chef > ssl_defaults['C'], ssl_defaults['ST'], ssl_defaults['L'], | |
chef > ssl_defaults['O'], ssl_defaults['OU'], node['fqdn'], ssl_defaults['emailAddress'] | |
chef ?> ) | |
=> "/C=CA/ST=BC/L=City/O=Company/OU=IT/CN=chef-ls-test-01.iad.company.com/emailAddress=servers@company.com" | |
chef > ssl_subject == `openssl x509 -in #{node['c_elk']['logstash']['extra_conf_dir']}/server.crt -noout -subject | cut -d " " -f 2-`.strip |
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 int_to_perm($int) { | |
return sprintf( | |
'%s%s%s', | |
$int & 4 ? 'r' : '-', // read | |
$int & 2 ? 'w' : '-', // write | |
$int & 1 ? 'x' : '-' // execute | |
); | |
} |
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 StrTok { | |
const INCL_PREV = 1; // include previous token at beginning of string | |
const INCL_CUR = 2; // include current token at end of string | |
const SKIP_EMPTY = 4; // skip empty strings | |
private $string, $tokens, $flags, $curpos; | |
public function __construct($string, $tokens, $flags=0) { | |
$this->string = $string; |
OlderNewer