View api_node_updater.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import json | |
import urllib2 | |
from datetime import datetime, timedelta | |
from sh import git, rm, cd | |
DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ' |
View gist:3378b204ab7513bc6024
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import argparse | |
import os | |
import shutil | |
from datetime import datetime, timedelta | |
RRD_PATH='/var/lib/collectd/rrd/' | |
parser = argparse.ArgumentParser() |
View mapconvert.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
import cgi | |
import json | |
import logging | |
import logging.handlers | |
import urllib2 | |
import cgitb | |
#import sys |
View heartbeat.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
import cgi | |
import json | |
import logging | |
import logging.handlers | |
import urllib2 | |
import cgitb | |
import sys |
View pygit2 api reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Basic API (low-level) | |
* public libgit2 structs should be python objects (classes) - Example: git_repository => Repository() | |
* nameing convention: strip git_`struct_name`_* - Example: git_repository_config() => Repository.config() | |
* iterations should be implemented as a generator, if this is not possible we | |
need to change libgit2 (other bindings will benefit from this as well) | |
* every method should map to one libgit2 function (exceptions are iterations) | |
* return values of methods | |
* no lists use generators instead | |
* no dictionaries use tuples or objects instead | |
* no instantiation of objects use strings instead (important for generators) |
View tree.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <git2.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int strocc(char* str, char c) { | |
int occ = 0, i = 0; | |
while(str[i] != '\0') | |
if(str[++i] == c) | |
++occ; |