Skip to content

Instantly share code, notes, and snippets.

View unicolet's full-sized avatar

Umberto Nicoletti unicolet

View GitHub Profile
@unicolet
unicolet / logstash.conf
Last active August 29, 2015 14:06
logstash conf for apache log files
input {
file {
type => "accesslog"
path => [ "/var/log/access_logs/access_log" ]
}
}
filter {
grok {
match => { "message" => "%{EXTENDEDAPACHELOG}" }
@unicolet
unicolet / el_template.json
Created September 11, 2014 14:32
Elastisearch template for apache extended log format
{
"template":"logstash-*",
"settings":{
"index.refresh_interval":"5s"
},
"mappings":{
"_default_":{
"dynamic_templates":[
{
"string_fields":{
@unicolet
unicolet / copy_extract.awk
Last active August 29, 2015 14:05
Extract copy instructions from a postgres dump in SQL format.
BEGIN {start=0}
/^COPY "/ { if(index($0,TBL)!=0) { start=1; } }
// {if(start==1) print $0;}
/\\\./ {start=0;}
function assembleLayer(conf) {
var constructorr=window, path=conf.provider.split(".");
// get a reference to the constructor, by walking the provider path
for(var i=0,l=path.length;i<l;i++) { constructorr=constructorr[path[i]]; }
// following constructor code from: http://stackoverflow.com/a/1608546/887883
// now invoke it
function F() {
return constructorr.apply(this, conf.args);
var layers=[
{provider:'OpenLayers.Layer.Bing',args:[{name: "Road",key: "AqTGBsziZHIJYYxgivLBf0hVdrAk9mWO5cQcb8Yux8sW5M8c8opEC2lZqKR1ZZXf",type: "Road"}]},
{provider:'OpenLayers.Layer.Bing',args:[{name: "Hybrid",key: "AqTGBsziZHIJYYxgivLBf0hVdrAk9mWO5cQcb8Yux8sW5M8c8opEC2lZqKR1ZZXf",type: "AerialWithLabels"}]},
{provider:'OpenLayers.Layer.Bing',args:[{name: "Aerial",key: "AqTGBsziZHIJYYxgivLBf0hVdrAk9mWO5cQcb8Yux8sW5M8c8opEC2lZqKR1ZZXf",type: "Aerial"}]}
];
var road = new OpenLayers.Layer.Bing({
name: "Road",
key: apiKey,
type: "Road"
});
var hybrid = new OpenLayers.Layer.Bing({
name: "Hybrid",
key: apiKey,
type: "AerialWithLabels"
});
#!/usr/bin/python -u
import snmp_passpersist as snmp
from collectd_unixsock import *
def update():
c = Collectd()
list = c.listval()
for val in list:
stamp, identifier = val.split()
values = c.getval(identifier)
@unicolet
unicolet / gist:7326456
Created November 5, 2013 21:15
WFS GetPropertyValue
$.get('http://162.13.113.151/geoserver/wfs?service=wfs&version=2.0.0&request=GetPropertyValue&outputFormat=application/json&typeNames=topp:states&valueReference=SUB_REGION',function(data) {
$(data).find('SUB_REGION').contents().each(function(i,v){console.log(v);})
});
this.invokeLater(function(){
Pony.getPath('mainPage.mainPane').append();
}, Pony.transitionSpeed*1000);
@unicolet
unicolet / views.js
Last active December 25, 2015 08:49
// define the transition duration globally
Pony.transitionSpeed=0.5;
// [more code here] //
// Automatic transitions, courtesy of SC 1.10
transitionIn: SC.View.SLIDE_IN,
transitionInOptions: { direction: 'down', duration: Pony.transitionSpeed, delay: Pony.transitionSpeed },
transitionOut: SC.View.SLIDE_OUT,