Зависимости для взаимодействия с GPIO
sudo apt install -y libgpiod2 python3-libgpiod
Создание и активация виртуального окружения (в примере использован python3.9
, установлен отдельно)
from collections import namedtuple | |
from dataclasses import dataclass | |
# from typing import NamedTuple | |
# Point = namedtuple("Point", "x, y") | |
AgeAndWeight = namedtuple( | |
"AgeAndWeight", | |
"age, weight", | |
) |
from typing import Final, Sequence | |
ADMIN_IDS: Final[Sequence[int]] = [1, 5] | |
# ADMIN_IDS: Final[Sequence[int]] = (1, 5) | |
# ADMIN_IDS: Final[tuple[int, ...]] = (1, 5, 8) | |
def main() -> None: | |
print(ADMIN_IDS) | |
ADMIN_IDS.append(7) |
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, select | |
from sqlalchemy.orm import sessionmaker, relationship, DeclarativeBase, selectinload | |
# DB_URL = "sqlite:///tags.db" | |
DB_URL = "sqlite:///:memory:" | |
DB_ECHO = False | |
class Base(DeclarativeBase): | |
id = Column(Integer, primary_key=True) |
def get_num() -> int: | |
return 42 | |
def get_word() -> str: | |
return "spam" | |
def main() -> None: | |
num = get_num() |
import java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
int[] numbers = {1, 2, 3, 2, 4, 5, 3, 6, 7, 4}; | |
HashMap<Integer, HashSet<Integer>> dictionary = new HashMap<>(); | |
for (int i = 0; i < numbers.length; i++) { | |
int number = numbers[i]; | |
if (!dictionary.containsKey(number)) { |
⎋ Escape, :, q, ⏎ Enter
// | |
// Created by Suren Khorenyan on 02.06.2023. | |
// | |
#include <iostream> | |
#include <cmath> | |
double equation(double a, double b, double x) { | |
return a * pow(x, 3) + b * x - 1; | |
} |