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
#include <msp430g2211.h> | |
#define I2C_SDA BIT0 // Serial Data line | |
#define I2C_SCL BIT6 // Serial Clock line | |
/* A crude delay function. Tune by changing the counter value. */ | |
void delay( unsigned int n ) { | |
volatile int i; | |
for( ; n; n-- ) { |
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 python | |
# ping a list of host with threads for increase speed | |
# use standard linux /bin/ping utility | |
from threading import Thread | |
import subprocess | |
try: | |
import queue | |
except ImportError: | |
import Queue as queue |
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
import math | |
def get_frost_point_c(t_air_c, dew_point_c): | |
"""Compute the frost point in degrees Celsius | |
:param t_air_c: current ambient temperature in degrees Celsius | |
:type t_air_c: float | |
:param dew_point_c: current dew point in degrees Celsius | |
:type dew_point_c: float |
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
#!/usr/bin/env python3 | |
from xml.dom import minidom | |
import requests | |
# some consts | |
HTTP_MULTI_STATUS = 207 | |
PROPFIND_REQUEST = '''<?xml version="1.0" encoding="utf-8" ?> | |
<d:propfind xmlns:d="DAV:"> | |
<d:prop xmlns:oc="http://owncloud.org/ns"> | |
<d:getlastmodified/> |
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/python3 | |
# detect tones in sound spectrum with scipy FFT | |
# here sound source is a USB microphone with ALSA (channel 1) | |
from collections import deque | |
import struct | |
import sys | |
import time | |
import threading |
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
#!/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 |
NewerOlder