Skip to content

Instantly share code, notes, and snippets.

@albertogaona
albertogaona / example-alarm.json
Created June 2, 2018 14:00 — forked from eddywashere/example-alarm.json
Example webhook data from Rackspace Cloud Monitoring
{
"event_id": "12345678910:1403052700000:OK",
"log_entry_id": "123456789101234567891012345678910",
"details": {
"target": "rackspace.com",
"timestamp": 1403052704485,
"metrics": {
"duration": {
"type": "I",
"data": 240,
@albertogaona
albertogaona / watcher.py
Created January 23, 2018 19:14 — forked from ajdavis/watcher.py
Script based on the Python "watchdog" module to run tasks when files change.
#!/usr/bin/env python
import os
import re
import threading
import time
import subprocess
from os.path import splitext, expanduser, normpath
import click
@albertogaona
albertogaona / _service.md
Created November 16, 2017 16:05 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@albertogaona
albertogaona / vm-backup.sh
Created August 10, 2017 18:48 — forked from cabal95/vm-backup.sh
I use this script to backup my QEMU/KVM/libVirt virtual machines. The script requires KVM 2.1+ since it uses the live blockcommit mode. This means the data in the snapshot disk is rolled back into the original instead of the other way around. Script does NOT handle spaces in paths.
#!/bin/bash
#
BACKUPDEST="$1"
DOMAIN="$2"
MAXBACKUPS="$3"
if [ -z "$BACKUPDEST" -o -z "$DOMAIN" ]; then
echo "Usage: ./vm-backup <backup-folder> <domain> [max-backups]"
exit 1
@albertogaona
albertogaona / InspectorZmd.py
Created February 8, 2017 15:34
Navegar las rutas de un dipositivo zenoss
"""Navega la estructura de un device y obtiene todas las graficas correspondientes al mismo"""
import logging
import os
import sys
import string
import xml.dom.minidom
from xml.dom.minidom import Document
#from Products.ZenModel.ConfigurationError import ConfigurationError
#from Products.ZenModel.DataRoot import DataRoot
@albertogaona
albertogaona / zen.py
Last active February 2, 2017 21:27
Provides a set of effective tools to query Zenoss database ( ZeoDB ) using an active socket.
""" Zen.py
Provides a set of effective tools to query Zenoss
database ( ZeoDB ) using an active socket.
Through this class all device features can be
retreived
"""
#import pdb #-- Se utiliza para habilitar el python debuger en modo command line
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;