Skip to content

Instantly share code, notes, and snippets.

View itarozzi's full-sized avatar

Ivan Tarozzi itarozzi

View GitHub Profile
@itarozzi
itarozzi / gauge.qml
Created May 20, 2022 14:00
QtQuick and Canvas example
import QtQuick 2.0
import QtQuick.Controls 1.4
import "constant.js" as Constants
Item {
id: root
property int thevalue:35
property bool editable: false
property int cTEMP_FASE_CALDA: 30
@itarozzi
itarozzi / Esp32 Arduino BLE vs NimBLE
Last active November 15, 2021 16:17
A comparison between ESP32 BLE Arduino lib and NimBLE
-------------------------------------------------------
------------------- LIB NimBLE :
> Executing task in folder flr_ble_midi_board: platformio run --target size --environment esp32dev <
source /home/ivan/software-projects-free/python-prj/ble_gatt_server/server1/.env/bin/activate
Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html

Consigli e considerazioni su sviuppo python per raspberry PI

(by Ivan Tarozzi - 10/06/2021)

Prendendo spunto da uno scambio di messaggi telegram sul gruppo FabLab Romagna (SMD 2023) e nella speranza che possa essere utile a chiunque voglia cimentarsi nella programmazione python su raspberryPI (o anche solo a chi voglia testare programmi python presi su git**b), riporto alcune indicazioni e considerazioni sull'esperienza appena conclusa e su modi alternativi di affrontare il problema.

Premetto che non sono un super-esperto di python e che le considerazioni che scriverò sono personali e perfettamente opinabili. Sono frutto della mia esperienza, ma non è detto che siano valide per tutti e che non possano essere smentite (anzi, chiunque legga e voglia apportare critiche costruttive o contributi diversi ben venga).

Caso di studio

@itarozzi
itarozzi / main.py
Created May 26, 2021 10:08
pyside2 translation
#!/usr/bin/env python3
# This Python file uses the following encoding: utf-8
import sys
import os
from PySide2.QtCore import QLocale
from PySide2.QtGui import QGuiApplication
from PySide2.QtQml import QQmlApplicationEngine
from app_config import ConfigSerial
@itarozzi
itarozzi / main.py
Created March 10, 2021 17:08
Styling QtQuick controls in PySide2 application
"""
A really simple PySide2 application using QtQuick and Material style
(it should work on PySide6 too)
In order to set a global theme for QtQuick you can use options as described below in the __main__.
You can override style properties in single qml files, if you want
To change the Material theme (dark, light, system) or other material properties you can use a
@itarozzi
itarozzi / main.py
Last active January 28, 2021 09:20 — forked from CoutinhoElias/main.py
Frame
from PySide2.QtWidgets import (QApplication, QWidget, QPushButton, QMainWindow, QSizePolicy,
QFrame, QLabel, QLineEdit, QHBoxLayout, QVBoxLayout)
from PySide2.QtGui import QIcon, QFont
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import (QCoreApplication, QPropertyAnimation, QDate, QDateTime, QMetaObject, QObject, QPoint, QRect, QSize, QTime, QUrl, Qt, QEvent)
import sys
@itarozzi
itarozzi / gist:ada2b37c99099f77dcb2733d45109a58
Created May 7, 2020 13:21
udev rules for xp-pen tablet
Tested on Manjaro Linux
==========================
$ cat /etc/udev/rules.d/98-xppen.rules
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="28bd/904/0", RUN+="/bin/su root -c '/opt/Linux_Pentablet/Pentablet_Driver.sh'"
$ cat /opt/Linux_Pentablet/Pentablet_Driver.sh
#!/bin/sh
HOME=/home/ivan
/////////////////////////////////////////////////////////////////
// ESP32 & Xiaomi Bluetooth sensor v1.00 //
// Get the latest version of the code here: //
// http://educ8s.tv/esp32-xiaomi-hack //
/////////////////////////////////////////////////////////////////
#include "SPI.h"
#include "Adafruit_GFX.h" //https://github.com/adafruit/Adafruit-GFX-Library
#include "Adafruit_ILI9341.h" //https://github.com/adafruit/Adafruit_ILI9341
@itarozzi
itarozzi / WifiSmartConfig.ino
Last active January 11, 2018 11:20
ESP8266/ESP32 WiFiSmartConfig
/* **************************************************************************************
* Test using WIFI SmartConfig for ESP8266/ESP32
*
* Download android app here:
* https://play.google.com/store/apps/details?id=com.cmmakerclub.iot.esptouch&hl=en
*
* TODO:
* [x] store ssid and password to flash
* [ ] try saved ssid and password and enter in SmartConfig if fails
@itarozzi
itarozzi / nodered-loop-example.json
Created December 26, 2017 14:47
Esempio di realizzazione di un loop (FOR-DO) all'interno di nodered
[{"id":"fed25495.5b2798","type":"inject","z":"8057655f.a7bd08","name":"","topic":"","payload":"5","payloadType":"num","repeat":"","crontab":"","once":false,"x":103,"y":117,"wires":[["34f34e08.bde052"]]},{"id":"57b232ee.d7d5bc","type":"function","z":"8057655f.a7bd08","name":"Loop","func":"// Loop function\n\nvar cnt = flow.get('loop_count')||0;\n\ncnt--;\n\nflow.set('loop_count', cnt);\n\nif (cnt >= 0) {\n // repeat again\n return [ null, msg ];\n}\nelse {\n // loop end\n return [ msg, null ];\n}\n\n","outputs":"2","noerr":0,"x":385,"y":132,"wires":[["3818f3b3.d2efac"],["527c1e03.1c10d"]]},{"id":"c39bdb58.03bd38","type":"debug","z":"8057655f.a7bd08","name":"","active":true,"console":"false","complete":"false","x":1038,"y":100,"wires":[]},{"id":"d1f83628.430bb8","type":"debug","z":"8057655f.a7bd08","name":"","active":true,"console":"false","complete":"false","x":774,"y":142,"wires":[]},{"id":"34f34e08.bde052","type":"change","z":"8057655f.a7bd08","name":"init","rules":[{"t":"set","p":"loop_count","p