- All metrics and aggregations have matching retentions
- A proper metric aggregator is already running
- The resulting metric file will then be used in a
whisper-fill
operation against the aggregator's actual metric files.
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 | |
// supplied encoding function | |
function stupidEncode($input, $key) { | |
$k = $key; | |
$r = $input; | |
$l = strlen($r); | |
$e = ""; | |
for($i=0; $i < $l; $i++){ |
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
// a complex iterator | |
function gen() { | |
$pagesize = 50; | |
while( $items = $someapi->paginated_operation($pagesize) ) { | |
foreach( $items as $item ) { | |
yield $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
<?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
require 'mysql2' | |
my = Mysql2::Client.new(:host => 'localhost', :username => 'root', :database=>'test') | |
stmt = my.prepare('INSERT INTO user (salt, password) VALUES(?,?);') | |
salt = "1a7v95zj1xa1l26g80meeaplc7294dp" | |
hashed = "4542511a19a5b18fd6801653ddc97b6e6ef3e855f4736720d791c4f4eed78957c0b5906921725a3ad0d8e98cf6722243f64e552382a37eb839f204d4fe6770ae" | |
stmt.execute(salt, hash) | |
# woops, that should be 'hashed', not 'hash'. |
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 | |
$cur = $seconds; | |
for( $i = count( $this->multipliers ) - 1; $i >= 0; $i -- ) { | |
$ps = $this->periodSize( $i ); | |
$parts[] = (int) floor( $cur / $ps ); | |
$cur -= $cur - ($cur % $ps); | |
} | |
var_dump($parts); |
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
In Metrics: | |
host-*.CPUload.{load1,load5,load15} | |
Function: | |
averageSeriesWithWildcards($in, 1) | |
Out Metrics, Expected: | |
host-*.CPUload.load1, | |
host-*.CPUload.load5, | |
host-*.CPUload.load15 | |
[exactly 3 series] | |
Out Metrics, Actual: |
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
# I've seen a _lot_ of code written to make bash prompts that are just _OK_, | |
# but there's no reason to invoke python/ruby/etc and parse git output since | |
# git ships with a pretty outstanding utility. | |
# 1. Load the library that already ships with git | |
source /usr/share/doc/${git_doc_path_here}/contrib/completion/git-prompt.sh | |
# 2. Set your options | |
export GIT_PS1_SHOWDIRTYSTATE=1 | |
export GIT_PS1_SHOWSTASHSTATE=1 |
Your postgres server is out of space to the point that VACUUM FULL
hits a table too large to write back out to disk even though other tables may still have space to give up.
Start with the tables that have the least amount of "un-wasted" space as they will require the minimal amount of free space to process, and hopefully the cumulative effect of releasing all of the space from the smaller tables allows you to process your larger tables as you go. If not, then there's no solution available to you short of deleting data or expading your disk.