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
class GeoClusterer { | |
private final double maxDistance; | |
private final List<GeoCluster> clusters = Lists.newArrayList(); | |
public GeoClusterer(double maxDistance, DistanceUnit unit) { | |
this.maxDistance = unit.convert(maxDistance, unit, DistanceUnit.KILOMETERS); | |
} | |
public GeoCluster add(GeoPoint point) { |
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
<!doctype html> | |
<html xmlns:ng="http://angularjs.org" ng:app> | |
<head> | |
<script src="http://docs-next.angularjs.org/angular-0.10.6.min.js"></script> | |
<script> | |
function MainCtrl() { | |
self = this; | |
this.name = 'Main'; | |
this.filter = [ ] | |
this.result = { }; |
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
import java.util.concurrent.TimeUnit; | |
import junit.framework.Assert; | |
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; | |
import org.elasticsearch.action.index.IndexResponse; | |
import org.elasticsearch.client.Client; | |
import org.elasticsearch.common.settings.ImmutableSettings; | |
import org.elasticsearch.common.settings.Settings; | |
import org.elasticsearch.common.unit.TimeValue; |
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
package search; | |
import java.util.Map; | |
import junit.framework.Assert; | |
import org.elasticsearch.action.search.SearchRequestBuilder; | |
import org.elasticsearch.action.search.SearchResponse; | |
import org.elasticsearch.client.Client; | |
import org.elasticsearch.common.settings.ImmutableSettings; |
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
{ | |
"query" : { | |
"match_all" : { } | |
}, | |
"facets" : { | |
"lt322cf7ts" : { | |
"terms" : { | |
"size" : 31, | |
"script" : "t=doc['timestamp'].date;t.addMillis(-28800000);v=t.getHourOfDay();v", | |
"lang" : "js" |
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
{ | |
"query" : { | |
"match_all" : { } | |
}, | |
"facets" : { | |
"lt322cf7ts" : { | |
"terms" : { | |
"size" : 31, | |
"script" : "t=doc['timestamp'].date;t.addMillis(-28800000);v=t.getHourOfDay();v", | |
"lang" : "js" |
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
import groovy.xml.MarkupBuilder | |
new MarkupBuilder().kml(xmlns : 'http://www.opengis.net/kml/2.2') { | |
new File(args?.size() ? args[0] : '.').eachFileMatch(~/.*\.gpx/) { file -> | |
new XmlParser().parse(file).trk.each { trk -> | |
trk.trkseg.each { trkseg -> | |
def geo = "" | |
trkseg.trkpt.each { trkpt -> | |
geo += "${trkpt.'@lon'},${trkpt.'@lat'}\n" | |
} |
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
sudo grep xmlrpc /var/log/apache2/access.log \ | |
| cut -d' ' -f1 | sort | uniq \ | |
| xargs -I{} sudo iptables -A INPUT -s {} -j DROP |
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
package benchmark; | |
import org.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.annotations.Mode; | |
import org.openjdk.jmh.annotations.Scope; | |
import org.openjdk.jmh.annotations.State; | |
import org.openjdk.jmh.runner.Runner; | |
import org.openjdk.jmh.runner.options.Options; | |
import org.openjdk.jmh.runner.options.OptionsBuilder; |
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
package benchmark; | |
import org.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.annotations.Mode; | |
import org.openjdk.jmh.annotations.Scope; | |
import org.openjdk.jmh.annotations.State; | |
import org.openjdk.jmh.infra.Blackhole; | |
import org.openjdk.jmh.runner.Runner; | |
import org.openjdk.jmh.runner.options.Options; | |
import org.openjdk.jmh.runner.options.OptionsBuilder; |
OlderNewer