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/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 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 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 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 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) |
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 | |
# build a square signal from sum of sin | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from scipy import signal | |
# number of samples | |
Ns = 2000 |
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 | |
import RPi.GPIO as GPIO | |
import time | |
import os, sys | |
import signal | |
GPIO.setwarnings(False) | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(31, GPIO.OUT) |
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 | |
# -*- coding: utf-8 -*- | |
import dateutil.parser | |
import requests | |
import pandas as pd | |
import datetime | |
# some consts | |
NAN = float('nan') |
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 | |
# RN2483 point to point test | |
# open serial link, init and display rx frames | |
import argparse | |
import serial | |
# some functions | |
def send_cmd(cmd): |