This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from argparse import ArgumentParser | |
from pathlib import Path | |
from typing import cast | |
parser = ArgumentParser( | |
description="Compares outputs of md5sum command on multiple files" | |
) | |
parser.add_argument("-i1", type=Path, required=True, help="First input filepath") | |
parser.add_argument("-i2", type=Path, required=True, help="Second input filepath") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original example at: https://docs.sqlalchemy.org/en/20/orm/dataclasses.html | |
from dataclasses import dataclass, field | |
from typing import List, Optional | |
from sqlalchemy.engine import create_engine | |
from sqlalchemy.orm import ( | |
Session, | |
mapped_column, | |
registry, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
import sys | |
import re | |
from subprocess import Popen, PIPE | |
VCP_FEATURE_CODE = 0x10 | |
VCP_FEATURE_NAME = "Brightness" | |
MIN_VALUE = 0 | |
REGEX_RESPONSE_PATTERN = "VCP code 0x(?P<vcp_feature_code>[0-9a-f]{2}) \((?P<vcp_feature_name>.+?)\s+\)\: current value =\s+(?P<current_value>\d+)\, max value =\s+(?P<max_value>\d+)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from queue import Queue | |
from inputs import devices | |
QUEUESIZE = 20 | |
TARGET_AXIS = "LX" | |
AXES = { | |
"ABS_X": "LX", | |
"ABS_Y": "LY", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spidev | |
# credits to http://raspberry.io/projects/view/reading-from-a-mcp3002-analog-to-digital-converter/ | |
# modified by Ramzi Sabra | |
class MCP3002: | |
def __init__(self, device=0): | |
self.conn = spidev.SpiDev(0, device) | |
self.conn.max_speed_hz = 1200000 # 1.2 MHz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inspired by cncjs-pendant-raspi-gpio: https://github.com/cncjs/cncjs-pendant-raspi-gpio | |
# This CNC.js pendant opens a connection to the CNC.js web server, opens a serial port connection, | |
# writes a command, then terminates. | |
import jwt | |
import logging | |
from socketIO_client import SocketIO, LoggingNamespace | |
SERVER_ADDRESS = "localhost" | |
SERVER_PORT = 8000 |