Dieses Handbuch behandelt die Programmierung von EV3 Hardware mithilfe von Python und der Lego Labview Software. Zuerst werden wir uns die Hardware anschauen.
Für den EV3
Für den EV3 ist eine besondere Vorbereitung notwendig.
zone="example.com" | |
sub="subdomain" # subdomain | |
email="fuu@example.com" # your cloudflare email | |
token="xxxxxxxxxxxxxx" # you api key | |
rid="xxx" # record id, find it with https://www.cloudflare.com/docs/client-api.html#s3.3 3.3 - "rec_load_all" - Retrieve DNS Records of a given domain | |
IP=$(curl http://icanhazip.com/) | |
echo "Setting cloudflare dns $sub.$zone to $IP" | |
curl https://www.cloudflare.com/api_json.html -d 'a=rec_edit' -d "tkn=$token" -d "id=$rid" -d "email=$email" -d "z=$zone" -d 'type=A' -d "name=$sub" -d "content=$IP" -d 'service_mode=0' -d 'ttl=1' |
[19:47:31] [Netty Client IO #11/DEBUG]: IN: [PLAY:33] go | |
[19:47:31] [Netty Client IO #11/DEBUG]: IN: [PLAY:33] go | |
[19:47:31] [Netty Client IO #11/DEBUG]: IN: [PLAY:33] go | |
[19:47:31] [Netty Client IO #11/DEBUG]: IN: [PLAY:33] go | |
[19:47:31] [Netty Client IO #11/DEBUG]: IN: [PLAY:33] go | |
[19:47:31] [Netty Client IO #11/DEBUG]: IN: [PLAY:33] go | |
[19:47:31] [Netty Client IO #11/DEBUG]: IN: [PLAY:33] go | |
[19:47:31] [Netty Client IO #11/DEBUG]: IN: [PLAY:33] go | |
[19:47:31] [Netty Client IO #11/DEBUG]: IN: [PLAY:33] go | |
[19:47:31] [Netty Client IO #11/DEBUG]: IN: [PLAY:33] go |
from tabulate import tabulate | |
from typing import List, Tuple | |
import re | |
Rule = Tuple[str, List[str]] | |
def rule_to_string(rule: Rule) -> str: | |
""" | |
Converts a rule to a string. | |
""" |