Skip to content

Instantly share code, notes, and snippets.

View jmparatte's full-sized avatar

Jean-Marc Paratte jmparatte

View GitHub Profile
@jmparatte
jmparatte / SQLite-PHP-quickstart.php
Created March 6, 2026 08:04 — forked from bladeSk/SQLite-PHP-quickstart.php
SQLite3 PHP Quickstart Tutorial
<?php
// This file walks you through the most common features of PHP's SQLite3 API.
// The code is runnable in its entirety and results in an `analytics.sqlite` file.
// Create a new database, if the file doesn't exist and open it for reading/writing.
// The extension of the file is arbitrary.
$db = new SQLite3('analytics.sqlite', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
// Errors are emitted as warnings by default, enable proper error handling.
@jmparatte
jmparatte / JUNTEK MHS5200A communication protocol.txt
Last active March 19, 2023 14:27
通信协议_EN - 3200_5200 communication protocol.docx
3200/5200 communication protocol
I. Overview:
The control command generally adopts the command line method, and the communication rate is 57600. The command is issued by the PC, analyzed and executed by the machine, and then the result is returned to the PC. The end character of each command is a newline character, which is represented by \n in C language (hexadecimal representation is 0x0a), and the different commands are explained below.
Two instruction categories:
1. s command: the function is used to set parameters
The command format is as follows:
English colon (:) + s + channel number (1 or 2) + command
The following command formats take 1-channel operation as an example
@jmparatte
jmparatte / i2cdetect.py
Last active July 14, 2022 00:44
i2cdetect.py
#!/usr/bin/env python3
"""
pi@raspberrypi:~ $ ./i2cdetect.py
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@jmparatte
jmparatte / Leap Second IERS Bulletin 63 expires 2022-12-28.md
Last active January 18, 2022 08:32
Leap Second IERS Bulletin 63 expires 2022-12-28
@jmparatte
jmparatte / esp32_taitime_utcsmear_v15.py
Created January 13, 2022 14:17
Leap second and time smearing with ESP32 MicroPython
import time
def time1_mktime(tm):
t = time.mktime(tm)
if tm[0]<MPY_MJD: t -= 2**32 # date < MicroPython epoch => previous u32 era !!!
return t
# https://developers.google.com/time/smear
# Value of TAI-UTC in second valid beetween the initial value until
# the epoch given on the next line. The last line reads that NO
# leap second was introduced since the corresponding date
# Updated through IERS Bulletin 63 issued in January 2022
#
#
# File expires on 28 December 2022
#
#
# MJD Date TAI-UTC (s)