Skip to content

Instantly share code, notes, and snippets.

@timbunce
timbunce / gist:5780999
Created June 14, 2013 10:53
Concurrent non-blocking connections in perl
use strict;
use Data::Dumper;
my @hosts = (
'74.125.24.101:80', # google
'74.125.24.101:9999', # google but bad port
'17.172.224.47:80', # apple
'117.53.170.202:80', # www.gov.au
);
@timbunce
timbunce / gist:7560988
Created November 20, 2013 10:31
Postgis GeoJSON silent massive loss of precision with coordinates specified as string values
This works as expected:
corp=> SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}')) As wkt;
wkt
---------------------------
POINT(-48.23456 20.12345)
but this doesn't:
corp=> SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"Point","coordinates":["-48.23456","20.12345"]}')) As wkt;

logstash queries graphed with graphite.

Operation: Decouple whisper from graphite.

Method: Create a graphite function that does a date histogram facet query against elasticsearch for a given query string for the time period viewed in the current graph.

Reason: graphite has some awesome math functions. Wouldn't it be cool if we could use those on logstash results?

The screenshot below is using logstash to watch the twitter stream of keywords "iphone" "apple" and "samsung" - then I graph them each, so we get an idea of popularity. As a bonus, I also do a movingAverage() on the iphone curve to show you why this is awesome.