Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/usr/bin/python | |
| import os | |
| import subprocess | |
| import time | |
| import yaml | |
| import re | |
| user_name = os.environ.get("DOCKERHUB_USER") |
| import asyncio | |
| from aiohttp import web | |
| import subprocess | |
| async def uptime_handler(request): | |
| # http://HOST:PORT/?interval=90 | |
| interval = int(request.GET.get('interval', 1)) | |
| # Without the Content-Type, most (all?) browsers will not render |
| function handleTabLinks() { | |
| var hash = window.location.href.split("#")[1]; | |
| if (hash !== undefined) { | |
| var hpieces = hash.split("/"); | |
| for (var i=0;i<hpieces.length;i++) { | |
| var domelid = hpieces[i]; | |
| var domitem = $('a[href=#' + domelid + '][data-toggle=tab]'); | |
| if (domitem.length > 0) { | |
| if (i+1 == hpieces.length) { | |
| // last piece |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!