Disable bluetooth and setup serial on /dev/ttyAMA0
/boot/config.txt
must contain:
enable_uart=1
dtoverlay=pi3-disable-bt
import weakref | |
class Same: | |
__the = None | |
def __new__(cls, *args, **kwargs): | |
if cls.__the is None or cls.__the() is None: | |
obj = super(Same, cls).__new__(cls) | |
cls.__the = weakref.ref(obj) |
import multiprocessing | |
import functools | |
import logging | |
from typing import Callable | |
class TimeLimitExceeded(Exception): | |
pass | |
from __future__ import annotations | |
import json | |
from typing import Any, Dict, List, Tuple, Union, cast | |
from typing_extensions import Protocol, runtime | |
# Type has to be ignored until mypy support recursive types (should be | |
# soon-ish, see mypy#731). This means that type errors one step down in a dict | |
# hierarchy will not be detected, since the "recursed" type will be interpreted |
defaults write com.apple.dock autohide-time-modifier -int 0; killall Dock | |
defaults write com.apple.Dock autohide-delay -float 0; killall Dock |
from typing import Callable, TypeVar | |
import functools | |
A = TypeVar('A') | |
B = TypeVar('B') | |
C = TypeVar('C') | |
def combine(f: Callable[[B], C], g: Callable[[A], B]) -> Callable[[A], C]: | |
def h(x: A) -> C: |
import re | |
import sys | |
import json | |
var_pattern = re.compile(r'^(?!\[)(?P<var>[A-z_-]+)\s*(?:=\s*(?P<val>.*))?$') | |
scope_pattern = re.compile(r'^\s*\[(?P<scope>[A-z_-]+)\]\s*$') | |
def get_lines(file_path): | |
with open(file_path, 'r') as f: |
class Reusing: | |
__free = [] | |
def __new__(cls, *args, **kwargs): | |
try: | |
return cls.__free.pop() | |
except IndexError: | |
return super(Reusing, cls).__new__(cls) | |
def __del__(self): |
$ systemctl enable rqworker@worker0{1..4}.service | |
$ systemctl start rqworker@worker0{1..4}.service | |
$ systemctl status 'rqworker@*' | |
$ journalctl -u 'rqworker@*' |
#!/usr/bin/env bash | |
set -euo pipefail | |
get_from () { | |
local file=$1 | |
local variable=$2 | |
echo "$( | |
source "$file" > /dev/null | |
eval "echo \"\$$variable\"" |