This file contains hidden or 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 hidden or 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 |
This file contains hidden or 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 datetime import datetime | |
import io | |
import sys | |
import urllib.request | |
import tkinter as tk | |
# sudo apt install python3-pil python3-pil.imagetk | |
import PIL.Image | |
import PIL.ImageTk | |
This file contains hidden or 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 | |
import logging | |
import os | |
import sys | |
import time | |
import traceback | |
import influxdb | |
This file contains hidden or 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 hidden or 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 | |
# pandas example with CSV data from atmospheric CO2 concentrations (ppm) at Mauna Loa, Observatory, Hawaii | |
# display current value with matplotlib | |
# try to predict future values with 2nd order polynomial coefficients auto-adjust | |
# test with numpy==1.16.2, pandas==0.19.2 | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt |
This file contains hidden or 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 | |
# sample compute of a DFT (Discrete Fourier Transform) with pure python code (without numpy usage) | |
from cmath import exp | |
from math import pi, sin | |
import random | |
def dft(samples): | |
xl = [0.0] * len(samples) |
This file contains hidden or 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 | |
# play with cv ( coefficient of flow) of control valve | |
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
import numpy as np | |
# some const (see http://www.idealvalve.com/pdf/Flow-Calculation-for-Gases.pdf) | |
SG = 0.554 |
This file contains hidden or 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
#!/bin/sh | |
# populate pub/ http directory with flyspray CSV export | |
# copy this script to /etc/cron.weekly | |
# csv file build name | |
YEAR=$(date +%Y) | |
CSV_FILE=export_$YEAR.csv | |
/usr/local/bin/flyspray2csv > /var/www/html/pub/flyspray/$CSV_FILE |
This file contains hidden or 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 | |
import random | |
key8 = ''.join(random.choice('0123456789ABCDEF') for n in range(16)) | |
key16 = ''.join(random.choice('0123456789ABCDEF') for n in range(32)) | |
print("generate 8 bytes key: %s" % key8) | |
print("generate 16 bytes key: %s" % key16) |