Moved to https://github.com/gregmac/Genmon-ESP32-Serial-Bridge
This is an ESPHome configuration for an ESP32 that monitors a sump pump pit, using the ESP32 capacitive touch sensors, with a level being reported to Home Assistant.
The ESP32 is mounted on a piece of PVC pipe, with wires extending down to different lengths. I used a length of old ethernet cable I had sitting around.
There's also a wire at the bottom connected to the ground pin, and this gives more reliable touch sensor values. The USB32 is powered from USB.
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
#include <ESPAsyncWebServer.h> | |
#include <AsyncElegantOTA.h> | |
// Port to listen on | |
#define WEBSERVER_PORT 80 | |
AsyncWebServer server(WEBSERVER_PORT); | |
void initWiFi() { | |
WiFi.mode(WIFI_STA); |
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
public static class MyExtensions | |
{ | |
// Write custom extension methods here. They will be available to all queries. | |
/// <summary>Dump a string using wrapping</summary> | |
public static string DumpWrapped(this string value, string title = null, int width = 120) | |
{ | |
string.Join("\n", value.Select((x, i) => i) | |
.Where(i => i % width == 0) |
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
# cleanups up the .nuget\packages directory | |
# * Keeps anything added within 120 days | |
# * Keeps the most recently used of every package | |
$maxAge = (Get-Date).AddDays(-120); | |
$deleted = 0; | |
$deletedMb = 0; | |
Get-ChildItem -Directory -Path ([IO.Path]::Combine($HOME, ".nuget", "packages")) | ForEach-Object { | |
Get-ChildItem -Directory -Path $_.Fullname | Sort-Object -Property LastWriteTime -Descending | ForEach-Object {$i=0} { | |
$sizeMb = [Math]::Round((Get-ChildItem -Path $_.FullName -Recurse | Measure-Object -Sum Length).Sum / 1MB, 2) |
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
screen mode id:i:2 | |
span monitors:i:1 | |
use multimon:i:1 | |
selectedmonitors:s:1,2 | |
pinconnectionbar:i:0 |
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
<# | |
Create a Start Menu shortcut for the settings for each camera on the system. | |
Requires ffmpeg installed via https://scoop.sh/ | |
(or modify to point at the proper ffmpeg.exe location) | |
#> | |
$ffmpeg = "`$env:USERPROFILE\scoop\apps\ffmpeg\current\bin\ffmpeg.exe" |
- Powershell 7
- Windows Terminal
- Rename computer:
Rename-Computer -NewName "Server044" -Restart
- Scoop
scoop install sudo
- Run Reclaim windows 10 script
- More Scoop apps:
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
public static class TaskExtensions | |
{ | |
public static async Task WaitSlowTask(this Task waitTask, TimeSpan slowTime, Action slowAction) | |
{ | |
var taskCompleted = new CancellationTokenSource(); | |
if (slowAction != null) | |
{ | |
_ = Task.Delay(slowTime, taskCompleted.Token).ContinueWith(_ => slowAction.Invoke(), TaskContinuationOptions.OnlyOnRanToCompletion); |
A (very) incomplete list of useful packages, mostly as a bookmark for myself.
- Nito.AsyncEx A helper library for async/await.
- RestSharp Simple REST and HTTP API Client
NewerOlder