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
import time | |
import subprocess | |
import datetime | |
""" | |
This class is used to execute a subprocess including a watchdog | |
""" | |
class Subprocess(object): | |
def __init__(self, cmd, cwd=None, stdout=None): | |
self.cmd = cmd |
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
from functools import wraps | |
import errno | |
import os | |
import signal | |
import time | |
#Source: http://stackoverflow.com/questions/2281850/timeout-function-if-it-takes-too-long-to-finish | |
class TimeoutError(Exception): | |
pass |
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
import heapq | |
import threading | |
class HeapThreadSafe(object): | |
def __init__(self): | |
self.sem = threading.Semaphore(1) | |
self.heap = list() | |
def push(self, obj): | |
self.sem.acquire() |
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
from datetime import datetime | |
import asyncore | |
from smtpd import SMTPServer | |
class EmlServer(SMTPServer): | |
no = 0 | |
def process_message(self, peer, mailfrom, rcpttos, data): | |
filename = '%s-%d.eml' % (datetime.now().strftime('%Y%m%d%H%M%S'), | |
self.no) | |
f = open(filename, 'w') |
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
/* | |
* There are three serial ports on the ESP known as U0UXD, U1UXD and U2UXD. | |
* | |
* U0UXD is used to communicate with the ESP32 for programming and during reset/boot. | |
* U1UXD is unused and can be used for your projects. Some boards use this port for SPI Flash access though | |
* U2UXD is unused and can be used for your projects. | |
* | |
*/ | |
#define RXD2 16 |
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
from datetime import datetime | |
import asyncore | |
from smtpd import SMTPServer | |
class EmlServer(SMTPServer): | |
no = 0 | |
def process_message(self, peer, mailfrom, rcpttos, data): | |
filename = '%s-%d.eml' % (datetime.now().strftime('%Y%m%d%H%M%S'), | |
self.no) | |
f = open(filename, 'w') |
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
// -*- c++ -*- | |
// -------------------------------------- | |
// i2c_scanner (using SoftWire and SoftI2CMaster) | |
// | |
// Version 1 | |
// This program (or code that looks like it) | |
// can be found in many places. | |
// For example on the Arduino.cc forum. | |
// The original author is not know. |
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
/********* | |
Rui Santos | |
Complete project details at https://RandomNerdTutorials.com/esp32-cam-video-streaming-web-server-camera-home-assistant/ | |
IMPORTANT!!! | |
- Select Board "AI Thinker ESP32-CAM" | |
- GPIO 0 must be connected to GND to upload a sketch | |
- After connecting GPIO 0 to GND, press the ESP32-CAM on-board RESET button to put your board in flashing mode | |
Permission is hereby granted, free of charge, to any person obtaining a copy |