Skip to content

Instantly share code, notes, and snippets.

View econeale's full-sized avatar

Neale Petrillo econeale

View GitHub Profile
@econeale
econeale / pyproject.toml
Created August 24, 2023 19:04
PyProject.toml for debugging
[tool.poetry]
name = "imager"
version = "0.0.0"
description = ""
authors = ["Neale Petrillo <neale@ecovative.com>"]
license = "Proprietary"
readme = "README.md"
packages = [{include = "imager"}]
[tool.poetry.dependencies]
@econeale
econeale / mqtt_client.py
Created March 14, 2022 19:19
Using persistent MQTT 5 connection with Paho MQTT Python
import paho.mqtt.client as client
import paho.mqtt.properties as props
properties = props.Properties(props.PacketTypes.CONNECT)
properties.SessionExpiryInterval=3600
mqtt_client = client.Client(client_id="test", userdata=None, protocol=mqtt.MQTTv5, transport="tcp")
mqtt_client.username_pw_set('mqtt_server_username', 'mqtt_server_password')
mqtt_client.connect('http://mqtt_server_address.com', 1234, clean_start=False, properties=properties)
@econeale
econeale / cluster_client.py
Created March 11, 2022 15:47
A wrapper for Paho MQTT Python client to interact with an MQTT cluster.
import random
from paho.mqtt.client import *
class ClusterClient(Client):
"""A subclass of paho.mqtt.Client that supports connecting to a cluster of
mqtt brokers. connect() and connect_async() additionally accept a list
of hostnames or host/port tuples:
connect("host1")
@econeale
econeale / pcnt_example.ino
Last active January 12, 2023 01:36
Use PCNT component in Arduino Sketch
#include "driver/pcnt.h"
uint8_t pcnt_pin = 16;
unsigned long check_time = 0;
int16_t count = 0;
pcnt_config_t tac_config;
void setup() {
Serial.begin ( 115200 );
@econeale
econeale / DefaultKeyBinding.dict
Created June 16, 2021 12:52
Remaps keys on Mac OS so that Home/End and selection works like Windows. Simply copy to your ~/Library/KeyBindings directory!
{
"\UF729" = moveToBeginningOfParagraph:; // home
"\UF72B" = moveToEndOfParagraph:; // end
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
"^\UF729" = moveToBeginningOfDocument:; // ctrl-home
"^\UF72B" = moveToEndOfDocument:; // ctrl-end
"^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
"^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
”^\UF702” = (moveWordLeft:); // ctrl-left