예제 #1
0
from notebook.auth import passwd
from auto import db
import sys

store = db.secure_db()

jupyter_password = store.get('DEVICE_JUPYTER_PASSWORD', None)

if jupyter_password is None:
    print("ERROR: DEVICE_JUPYTER_PASSWORD is not set", file=sys.stderr)
    sys.exit(1)

hashed_password = passwd(jupyter_password)

template = sys.argv[1]

with open(template, 'r') as f:
    f_text = f.read()
    print(f_text.replace(r'<JUPYTER_PASSWORD>', repr(hashed_password)))

예제 #2
0
from auto import print_all
from auto import console

import myzbarlight
import util

import subprocess
import json
import time
import cv2
import sys

from auto import logger
log = logger.init('wifi_controller', terminal=True)

STORE = secure_db()

wireless = Wireless(list_wifi_ifaces()[0])

system_priv_user = sys.argv[1]  # the "Privileged" system user

log.info("Starting Wifi controller using the privileged user: {}".format(
    system_priv_user))


def _get_one_button_press():
    buttons = acquire('PushButtons')
    try:
        while True:
            events = buttons.get_events()
            presses = [e['button'] for e in events if e['action'] == 'pressed']