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 uasyncio as aio | |
import aioble | |
from bluetooth import UUID | |
import random | |
import struct | |
# org.bluetooth.service.environmental_sensing | |
_ENV_SENSE_UUID = UUID(0x181A) | |
# org.bluetooth.characteristic.temperature |
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 collections import defaultdict | |
from typing import Dict | |
from pyModbusTCP.server import DataBank, ModbusServer | |
class MyDataBank(DataBank): | |
class Data: | |
def __init__(self) -> None: |
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 dataclasses import dataclass | |
from datetime import datetime | |
from queue import Empty, Queue | |
import re | |
import subprocess | |
from threading import Thread | |
import time | |
@dataclass |
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/bin/env python3 | |
""" Send mail with SMTP protocol. """ | |
import logging | |
import re | |
import smtplib | |
from typing import List, Union | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText |
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 uasyncio as aio | |
from machine import Pin | |
import network | |
import rp2 | |
import errno | |
import urequests | |
import gc | |
from private_data import WIFI_SSID, WIFI_KEY | |
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/bin/env python3 | |
"""Fit a polynomial to reflect the Cv curve of a control valve (Cv/position).""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# a list of reference points extracted from the data sheet of the valve | |
ref_pts_l = [(0, 0), (4, 5), (10, 15), (16, 21), (20, 25), (30, 40), (40, 75), |
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
""" | |
A basic ACL test script tool. | |
Test under Python 3.10 on Windows 10 Entreprise (64 bits) | |
home: https://gist.github.com/sourceperl/548b7cfb35629eceee7163e877bb62d7 | |
""" | |
import logging | |
import socket |
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/bin/env python3 | |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer | |
from random import randint | |
class HandleRequests(BaseHTTPRequestHandler): | |
"""Custom HTTP handler""" | |
def version_string(self): | |
return 'self-service here ;-)' |
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/bin/env python3 | |
""" | |
Some function to deal with Cv flow coefficient of gas valve. | |
https://www.swagelok.com/downloads/webcatalogs/EN/MS-06-84.pdf | |
""" | |
import math |
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/bin/env python3 | |
from datetime import datetime | |
import time | |
import io | |
import sys | |
import urllib.request | |
# sudo pip3 install schedule | |
import schedule | |
# sudo apt install python3-pil python3-pil.imagetk |
NewerOlder