Skip to content

Instantly share code, notes, and snippets.

View KevM's full-sized avatar

Kevin Miller KevM

View GitHub Profile
@KevM
KevM / pypowerwall.env
Last active April 8, 2024 11:22
PyPowerwall Debug
PW_TIMEZONE=America/Chicago
PW_STYLE=grafana-dark
TZ=America/Chicago
PW_DEBUG=yes
PW_CACHE_EXPIRE=30
PW_POOL_MAXSIZE=1
@KevM
KevM / main.go
Last active March 15, 2024 20:11
Integration of ARPC with Gin
package main
import (
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
func main() {
router := gin.New()
logger := zap.NewNoOp() //replace with your logger
@KevM
KevM / foo.go
Last active February 23, 2024 17:58
wee
package wee
func Yippie(s string) {
log.Printf("yippie! %s". s)
}
@KevM
KevM / docker-compose.yml
Last active February 2, 2021 20:14
Minecraft Docker Compose file for Azure
version: "3.7"
services:
mc:
image: itzg/minecraft-server
domainname: my-domain-name
ports:
- 25565:25565
environment:
EULA: "TRUE"
@KevM
KevM / task-experiment.cs
Created December 11, 2020 14:36
exception_in_one_task_should_not_affect_others
public class Experiment
{
private readonly ITestOutputHelper _outputHelper;
public Experiment(ITestOutputHelper outputHelper)
{
_outputHelper = outputHelper;
}
[Fact]
@KevM
KevM / observable_extensions.cs
Created July 5, 2018 20:05
Testing Observables
public static class ObservableExtensions
{
public static Func<bool> WasObserved<T>(this IObservable<T> observableUnderTest, T expected)
{
var wasExpectedObserved = false;
var result = observableUnderTest.Subscribe(s =>
{
wasExpectedObserved = s.Equals(expected);
});
@KevM
KevM / solution-load-times.md
Last active April 10, 2018 20:24
Large .Net Solution Load times

We have a large solution with about 69 projects. Here are the load times I measured in a very non-scientific way.

  1. I opened the IDE.
  2. Clicked on the solution in the MRU selection.
  3. Timed on my phone how long it took to get to a point where a file is editable.
  4. Did a warm up then repeated this 3 times for each configuraion.
App Version Detail Time Notes
@KevM
KevM / regex.txt
Created November 19, 2016 23:27
Port Nuget packages to Paket Regex
Include="(.*\w)(\,\sVersion.*MSIL")>
Include="\1">
packages\\(.*[a-zA-Z])\.\d+((?:\.\d+){1,5})\\lib
packages\\$1\\lib
@KevM
KevM / Reactive.Config-readme.md
Last active November 19, 2016 11:50
Reactive Configuration

Reactive Configuration

Wouldn’t it be great to take a dependency on a Concrete POCO and know that it’s state is de-serialized from the most recent configuration settings for your system? Your IoC container could be configured to create Configured Types whose state is determined by potentially many Configuration Stores. Each store would source its configuration settings from a different location (env, appSettings, Consul). A Configuration Registry would setup the Configuration Stores in play and their precedence.

Having a robust, reactive, and easy to use configuration story is liberating and can be used as a foundation layer for additional functionality such as Feature Toggles and A/B testing.

Configuration Stores

Configuration stores are responsible for matching the key space for a Configured Type with the source of configuration backing them. Say a source backed by environment variables is asked if it is a source for the POCO whose full qualified namespace is Cald

Once upon a time there was a junior developer who had a simple ticket
assigned to him to make a new checkbox. The straightforward implementation
required a schema change to implement. Being a fastidious fellow, he wanted to
follow the proper procedure and searched the wiki.
The wiki described a procedure that required he run a particular script against
the qa database server and add the output to his ticket. He looked over the
script and found that it would not run on his macOS box.
After editing the script so that it would run on his laptop, he submitted the