Skip to content

Instantly share code, notes, and snippets.

// The LatencyStat object is a POJO with three fields: bucket, percentile and latency
// The goal is to get a new List<LatencyStat> with one object per (bucket, percentile) combination
// averaging the latency value between them.
Map<String, Map<Double, List<SearchLatencyProbe.LatencyStat>>> foo = nodes.stream()
.flatMap(n -> n.statDetails.latencies.stream())
.collect(Collectors.groupingBy(LatencyStat::getBucket,
Collectors.groupingBy(LatencyStat::getPercentile)));
List<LatencyStat> allNodes = new ArrayList<>();
for (Map.Entry<String, Map<Double, List<LatencyStat>>> bucketEntry : foo.entrySet()) {
for (Map.Entry<Double, List<LatencyStat>> percentileEntry : bucketEntry.getValue().entrySet()) {
{
"type": "record",
"name": "CirrusSearchRequestSet",
"namespace": "org.wikimedia.mediawiki.search",
"doc": "A set of requests made by CirrusSearch to the elasticsearch user for a single php execution context",
"fields": [
{
"name": "wikiId",
"doc": "The wiki making this request, such as dewiki or enwiktionary",
"type": "string"
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package org.wikimedia.mediawiki.search;
@SuppressWarnings("all")
/** An individual request made between mediawiki and elasticsearch */
@org.apache.avro.specific.AvroGenerated
public class CirrusSearchRequest extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
@ebernhardson
ebernhardson / first.php
Last active August 29, 2015 14:23
When running reproduce.php both eval'd pieces of code output "first", but the second one should be outputting "second"
return function ($in, $debugopt = 1) {
return (function() {return 'first';})();
};
@ebernhardson
ebernhardson / gist:4b58fd87fedfcdd2b032
Last active August 29, 2015 14:05
Serializer.php
<?php
namespace Flow\Serializer;
use Flow\Data\UserNameBatch;
use Flow\Model\AbstractRevision;
use Flow\Model\UserTuple;
use Flow\Model\UUID;
use Flow\Templating;
use ArrayIterator;
<?php
namespace Flow\Data;
use Flow\Exception\FlowException;
use Flow\Model\PostRevision;
use Flow\Model\Workflow;
use Flow\WatchedTopicItems;
use WatchedItem;
<?php
echo "Replace wgMemc\n";
$realMemc = $wgMemc;
$wgMemc = new HashBagOStuff;
echo "Locate workflow for ", $argv[1], "\n";
$workflow = Flow\Container::get( 'factory.loader.workflow' )->createWorkflowLoader( Title::newFromText( $argv[1] ) )->getWorkflow();
echo "Get list of topics\n";
<?php
require('src/lightncandy.php');
$template = "{{!-- --}}\n{{#foo}}{{this}}{{/foo}}";
$php = LightnCandy::compile($template, array(
'flags' => LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_THIS
));
echo "Rendered PHP code is:\n$php\n\n";
$renderer = LightnCandy::prepare($php);
vagrant@mediawiki-vagrant:~/fastcgi$ sudo gdb /usr/bin/hhvm
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
/**
* Maintenance script that populates the event_page_id column of echo_event
*
* @ingroup Maintenance
*/
class updateEchoSchemaForSuppression extends Maintenance {
public function __construct() {
parent::__construct();
$this->mBatchSize = 500;