Skip to content

Instantly share code, notes, and snippets.

View kedare's full-sized avatar

Mathieu Poussin kedare

View GitHub Profile
@kedare
kedare / graph.py
Last active August 29, 2015 13:57
A graphviz map generator that gets data from Observium database
#! /usr/bin/env python
"""
graph.py A small tool that allows you to generate a visual representation of your devices and links using discovery
protocols from the links table of Observium
Author: Mathieu Poussin <mathieu.poussin@oxalide.com>
Date: 01/2015
Usage: This program accepts many arguments :
--debug : Debug mode, write one image per step
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @author Adam Armstrong <adama@memetic.org>
@kedare
kedare / gist:8db2a727c7c3504bec8d
Created June 16, 2014 12:48
Observium report page
<?php
function secondsToTime($seconds) {
$dtF = new DateTime("@0");
$dtT = new DateTime("@$seconds");
return $dtF->diff($dtT)->format('%a days, %h hours, %i minutes and %s seconds');
}
// HIGHEST UPTIMES
xml2json = require "xml2json"
fs = require "fs"
util = require "util"
request = require "request"
#sleep = require "sleep"
tumblr_name = process.argv[2]
api_endpoint = util.format "http://%s.tumblr.com/api/read", tumblr_name
start = 0
num = 50
#!/usr/bin/perl -w
use v5.14;
use Curses::UI;
my $cui = new Curses::UI( -color_support => 1, -clear_on_exit => 1);
for my $second (reverse(1..2)) {
$cui->status("Attaching to TMUX in $second second(s)\n Press CTRL-C to avoid TMUX");
sleep 1;
}
@kedare
kedare / disk.py
Created January 18, 2016 15:20
Powerline disk space widget
import os
import humanfriendly
def disk(pl, monitor="/", threshold_gig=10):
partition = os.statvfs(monitor)
available = partition.f_bsize * partition.f_bavail
available_gig = available / 1024 ** 2
threshold_crit_gig = threshold_gig*0.5
ret = []
package main
import (
"crypto/sha256"
"encoding/hex"
"io/ioutil"
"os"
"sync"
"github.com/fatih/color"
# Standard packages
{% for package in pillar["ci"]["packages"]["standards"] %}
Package {{ package }} should have the revision {{ pillar["ci"]["revision"] }} active for the {{ pillar['application_environment'] }} environment:
svn.latest:
- name: http://xxxx/{{ pillar['application_environment'] }}/{{ package }}/trunk
- target: C:\inetpub\wwwroot\{{ pillar['application_environment'] }}\{{ package }}
- rev: {{ pillar["ci"]["revision"] }}
- username: {{ pillar["ci"]["svn"]["username"] }}
- password: {{ pillar["ci"]["svn"]["password"] }}
The error:
salt "bcn6-web-staging-1" state.apply windows.services.iis.sites
bcn6-web-staging-1:
Data failed to compile:
----------
Rendering SLS 'base:windows.services.iis.sites' failed: while parsing a block mapping
in "<unicode string>", line 3, column 1:
Create xxxstaging.com site:
^
----------
ID: Python should be installed
Function: pkg.installed
Name: xxx-python3
Result: False
Comment: The following packages failed to install/update: xxx-python3=3.6.1
Started: 16:26:20.519000
Duration: 82535.0 ms
Changes:
----------