Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Fri Jun 26 13:16:22 2015 | |
| @author: zah | |
| """ | |
| import multiprocessing | |
| import logging |
| """ | |
| remconsole.py | |
| A Python console you can embed in a program and attach to remotely. | |
| To spawn a Python console in a script do the following in any scope | |
| of any module: | |
| import remconsole | |
| remconsole.spawn_server() |
| import os | |
| import sys | |
| import traceback | |
| from functools import wraps | |
| from multiprocessing import Process, Queue | |
| def processify(func): | |
| '''Decorator to run a function as a process. | |
| Be sure that every argument and the return value |
| from multiprocessing import Pool | |
| from itertools import chain | |
| import re | |
| import sys | |
| PROC_COUNT = 8 | |
| LINES_PER_PROC = 40 | |
| if len(sys.argv) != 3: |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| from microbit import * | |
| networkID = 0 # Change the channel variable in the radio.configure to this | |
| def selectNetwork(): # Call this function before calling anything else | |
| global networkID | |
| currentID = networkID | |
| while True: | |
| if button_a.is_pressed() and button_b.is_pressed(): | |
| networkID = currentID |
| # `ref: https://fangpenlin.com/posts/2012/08/26/good-logging-practice-in-python/ | |
| import logging | |
| logger = logging.getLogger(__name__) | |
| logger.setLevel(logging.INFO) | |
| # create a file handler | |
| handler = logging.FileHandler('hello.log') |
| #!/bin/bash | |
| TOOLBOX_DOCKER_IMAGE=$1 | |
| TOOLBOX_USER=root | |
| machinename=$(echo "${USER}-${TOOLBOX_DOCKER_IMAGE}" | sed -r 's/[^a-zA-Z0-9_.-]/_/g') | |
| machinepath="/var/lib/toolbox/${machinename}" | |
| if [ ! -d ${machinepath} ] || systemctl is-failed ${machinename} ; then | |
| sudo mkdir -p "${machinepath}" |
OpenELEC runs Kodi, an award-winning free and open source (GPL) software media player and entertainment hub for digital media. For more info see http://kodi.tv . The base system has been designed and built from the ground up to be as efficient as possible – consuming only tiny disk and memory footprints and providing cutting edge hardware support to deliver a set-top box experience.
In order to run software above the base OpenELEC distribution with minimal impact to the OpenELEC base, one alternative is to use a container.
I have chosen to use systemd-nspawn instead of chroot. There are really no downsides as long as you can configure the required kernel config options and have a basic working knowledge of systemd.
Installation