Skip to content

Instantly share code, notes, and snippets.

View msonnabaum's full-sized avatar

Mark Sonnabaum msonnabaum

  • Lithic
  • San Diego, CA
View GitHub Profile
function git {
test -z $GITCOMMAND && GITCOMMAND=`which git`
if [ "$1" == "git" ]
then
git $2
else
$GITCOMMAND $1
fi
}
def bsearch_index(ary)
low = 0
high = ary.length
smaller = 0
satisfied = 0
while low < high
mid = low + ((high - low) / 2)
val = ary[mid]
begin
#!/usr/bin/env php
<?php
$file_contents = file_get_contents("php://stdin");
$data = unserialize($file_contents);
$results = [];
foreach ($data as $key => $values) {
list($caller, $callee) = explode('==>', $key);
#!/usr/bin/env php
<?php
$whitelist = [
"main()",
"MemcachePool::get",
"PDOStatement::execute",
"PDO::commit",
"DatabaseStatementBase::execute",
"InsertQuery_mysql::execute",
#!/usr/bin/env ruby
require "optparse"
DEFAULT_QUANTILES = [0.25, 0.50, 0.75, 0.90, 0.95, 0.99, 0.999]
def quantile(values, p, presorted = false)
return values.first if values.size == 1
values = values.sort unless presorted
hh = (values.size - 1) * p + 1
h = hh.floor
if (!"ggplot2" %in% rownames(installed.packages())) {
install.packages("ggplot2")
}
library("ggplot2")
args <- commandArgs(trailingOnly = TRUE)
before_file <- args[1]
after_file <- args[2]
library("rvest")
library("dplyr")
ec2_df <- html("http://www.ec2instances.info") %>%
html_nodes("table") %>%
first %>%
html_table()
str(ec2_df)
135 FieldCollectionItemEntity::hostEntity
-> 67 entity_revision_load
-> 67 PanelsPaneController::load
-> 67 EntityCacheControllerHelper::entityCacheLoad
-> 67 PanelsPaneController::attachLoad
-> 67 DrupalDefaultEntityController::attachLoad
-> panelizer_entity_load 362ms
-> PanelizerEntityDefault::has_default_panel
-> 1 PanelizerEntityDefault::default_display_exists 303ms
-> 1 ctools_export_load_object
diff --git a/puppet/versions/devel/modules/xhprof/files/acquia_xhprof/acquia_xhprof.php b/puppet/versions/devel/modules/xhprof/files/acquia_xhprof/acquia_xhprof.php
index 5cfa756..1bcf4e3 100644
--- a/puppet/versions/devel/modules/xhprof/files/acquia_xhprof/acquia_xhprof.php
+++ b/puppet/versions/devel/modules/xhprof/files/acquia_xhprof/acquia_xhprof.php
@@ -38,8 +38,11 @@ function acquia_hosting_xhprof_enabled() {
// Can't use ini_get here since it's a custom variable.
$xhprof_enabled = get_cfg_var('acquia.xhprof_enabled');
- $ret = FALSE;
if ($xhprof_enabled) {
#!/usr/bin/env php
<?php
function xhprof_raw_format_to_call_records($run_id, $raw_xhprof, $whitelist, $params = array()) {
$calls = array();
foreach ($raw_xhprof as $key => $values) {
if ($key === 'main()') {
$caller = "";
$callee = "main()";
}