Looking at Recurve open-source projects for calculating avoided energy use
GridMeter uses non-participant comparison groups for the calculation of customer baselines and avoided energy use (erasing) during Demand Response events.
Demo Notebook combining both projects: https://colab.research.google.com/drive/1HPBz7Z6_kabAUWL7_WNG3Wvx-tpjvGop
Noticing dramatic memory and CPU usage decrease after migrating one application from .NET Core 3.1 to .NET 6.0.
Memory usage is about 25% of previous version. CPU usage is about 10% of previous version.
Update Horizontal Pod Autoscaler (HPA) configuration:
# Get list of HPAs
$ kubectl get hpa
# Get HPA json
$ kubectl get hpa <name> -o json
# Option 1: Edit resource
$ kubectl edit hpa
# Option 2: Patch resource
$ kubectl patch hpa <name> --patch "{\"spec\":{\"minReplicas\":3}}"
New Beta version of System.CommandLine was published 20 days ago. Announcement: https://github.com/dotnet/command-line-api/issues/1537
Main breaking change is that the CommandHandler
type no longer exists.
Really like the new API for binding options. I feel that it is more intuitive and less error prone than the previous one.
var boolOption = new Option<bool>("--bool");
var intOption = new Option<int>("--int", () => 4);
var floatOption = new Option<float>("--float", () => 0.25f);
var myCommand = new Command("my-command", "The command description")
{
boolOption,
intOption,
floatOption
};
myCommand.SetHandler<bool, int, float>(
(myBool, myInt, myFloat) => {
// Handler code goes here
},
boolOption,
intOption,
floatOption);
Custom binders can be used to configure services with the generic host builder.
Custom binder example:
public class MyCustomBinder : BinderBase<IHostBuilder>
{
protected override IHostBuilder GetBoundValue(BindingContext bindingContext)
{
return Host.CreateDefaultBuilder()
.ConfigureServices((ctx, services) =>
{
services.AddSingleton<MyService>();
});
}
}
var myCommand = new Command("my-command", "The command description");
myCommand.SetHandler<IHostBuilder>(
async hostBuilder => {
// If background services are registered (Hosted Services), the host must be started in order to execute the background services.
using var host = await hostBuilder.StartAsync();
// Otherwise we could just build the host to get the ServiceProvider: var host = hostBuilder.Build();
var myService = host.Service.GetRequiredService<MyService>();
await myService.DoSomethingAsync();
},
new MyCustomBinder());