Skip to content

Instantly share code, notes, and snippets.

import json
import sys
obj = json.loads(sys.stdin.read())
for row in obj["result"]:
ip = []
for ifs in row["interfaces"]:
ip.append("[id:{0},ip:{1}]".format(ifs["interfaceid"], ifs["ip"]))
print ("hostid : {0}, host : {1}, interfaces : {2}".format(row["hostid"], row["host"], ', '.join([str(x) for x in ip])))
<?php
// php makephar.php create - create phar from last git commit
// php makephar.php deploy [suffix number] - Unpack the phar file with the maximum / specific suffix number
$exclude = ['/^resource/', '/^Wise/'];
$chmod = 644;
if (! isset($argv[1])) {
exit;
}