Skip to content

Instantly share code, notes, and snippets.

View unicolet's full-sized avatar

Umberto Nicoletti unicolet

View GitHub Profile
@unicolet
unicolet / VmReconfigNetwork.groovy
Created October 27, 2012 08:24
Script to reconfigure a vSphere vm first network adapter
import java.net.URL
import com.vmware.vim25.*
import com.vmware.vim25.mo.*
/*
Example invocation:
groovy -cp lib/dom4j-1.6.1.jar:lib/vijava50120120518.jar Sample.groovy 1 2 3 websphere "Network adapter 1" DMZ
*/
@unicolet
unicolet / pillar-data
Created October 22, 2012 15:06
manage snmpd with salt
snmp_ro_community: xxxxxxx
snmp_management_station: 10.0.0.1
@unicolet
unicolet / poller2provisiond.xslt
Created September 20, 2012 08:48
(rough draft, but working) collects Windows* service names from poller-configuration.xml and outputs a config for provisiond
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:opennms="http://xmlns.opennms.org/xsd/config/poller"
version="1.0">
<xsl:template match="opennms:service">
<xsl:if test="contains(@name, 'Windows')">
<xsl:element name="detector">
<xsl:attribute name="class">org.opennms.netmgt.provision.detector.snmp.Win32ServiceDetector</xsl:attribute>
@unicolet
unicolet / salt-minion
Created August 24, 2012 16:03
SLES init.d script for salt-minion
#!/bin/bash
#
# Template SUSE system startup script for example service/daemon salt-minion
# Copyright (C) 1995--2005 Kurt Garloff, SUSE / Novell Inc.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or (at
# your option) any later version.
#
@unicolet
unicolet / sc_query_lang.js
Created August 21, 2012 09:47
Local query with Sproutcore Query language and transient vars
/**
* Created with JetBrains WebStorm.
* User: unicoletti
* Date: 8/21/12
* Time: 11:00 AM
* To change this template use File | Settings | File Templates.
*/
AA={};
@unicolet
unicolet / links.pl
Created July 15, 2012 16:44
Find latest Tomcat 7 version
@unicolet
unicolet / refresh list view.js
Created July 6, 2012 12:25
Refresh SC.ListVIew (and scroll down)
/*
NOTE: replace YourListView/YourController with the actual names of the
controller/listview in your app.
*/
YourController.content.add(yournewobject);
this.invokeLater(function(){
YourListView.computeLayout();
YourListView.scrollDownPage();
@unicolet
unicolet / reader.py
Created June 27, 2012 10:35
Nagios cfg from Google Docs
import csv
from jinja2 import Template,FileSystemLoader,Environment
loader = FileSystemLoader('templates')
env = Environment(loader=FileSystemLoader('templates'))
tmp=[]
hostgroups=set()
hosts = csv.reader(open('hosts.csv'), delimiter=',', quotechar='"')
for h in hosts:
@unicolet
unicolet / osm_bright_bg
Created June 6, 2012 07:34
TileDrawer: change bright style background color
--- style.xml.orig 2012-05-31 15:39:50.080704580 +0200
+++ style.xml 2012-05-31 15:40:36.856701370 +0200
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over" bgcolor="rgb(140,182,211)">
+<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over" bgcolor="rgb(241,238,232)">
<Style name="line pattern style 110">
<Rule name="rule 589">
<Filter>(not (([tunnel]='true')) and not (([tunnel]='yes')))</Filter>
@unicolet
unicolet / jsts_with_nodejs.js
Created May 28, 2012 10:52
using jsts (Javascript Topology Suite) with nodejs
#!/usr/bin/nodejs
# run from jsts directory, the script expects lib to be a subdir of current dir
var i = require('./lib/javascript.util.js');
var j = require('./lib/jsts.js');
var geometryFactory = new jsts.geom.GeometryFactory();
var coordinate = new jsts.geom.Coordinate(1,2);
var point = geometryFactory.createPoint(coordinate);