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
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;