Skip to content

Instantly share code, notes, and snippets.

Avatar

Mathieu Poussin kedare

View GitHub Profile
@kedare
kedare / graph.py
Last active Aug 29, 2015
A graphviz map generator that gets data from Observium database
View graph.py
#! /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
View gist:11369097
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @author Adam Armstrong <adama@memetic.org>
View gist:8db2a727c7c3504bec8d
<?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
View gist:d4ac3c15f9d8424a84aa
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
View tmux_pre_attach.pl
#!/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 Jan 18, 2016
Powerline disk space widget
View disk.py
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 = []
View sum.go
package main
import (
"crypto/sha256"
"encoding/hex"
"io/ioutil"
"os"
"sync"
"github.com/fatih/color"
View gist:32b6a7b4730af89c21efa2f78f1657f2
# 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"] }}
View gist:7564a9a02ead86701a888b313fb997c4
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:
^
View install.log
----------
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:
----------
You can’t perform that action at this time.