Skip to content

Instantly share code, notes, and snippets.

View nishanc's full-sized avatar
🚀
This is the way!

Nishan Chathuranga Wickramarathna nishanc

🚀
This is the way!
View GitHub Profile
using Microsoft.Extensions.FileProviders;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot>
# WARNING: This script will delete everything in Downloads, Pictures, Videos, Documents\PowerShell folders for the specified user and the D: drive.
# Use it at your own risk.
# Specify the user's profile folder
$userProfile = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::UserProfile)
# Specify the folders to delete for the user
$userFoldersToDelete = @("Downloads", "Pictures", "Videos", "Documents\PowerShell")
# Specify the drive to delete
[MemoryDiagnoser]
public class BenchmarkDemo2
{
private static readonly string _dateString = "01 05 1991";
[Benchmark(Baseline = true)]
public DateTime Original()
{
var day = _dateString.Substring(0, 2);
var month = _dateString.Substring(3, 2);
using CustomerChurnMLDemo;
using Microsoft.ML;
using Microsoft.ML.Data;
using Microsoft.ML.AutoML;
class Program
{
static void Main(string[] args)
{
string trainDataFilePath = @"D:\CustomerChurnMLDemo\CustomerChurnMLDemo\Data\customer_churn_dataset-training-master.csv";
// Import the necessary ML.NET namespace
using Microsoft.ML;
using CustomerChurnMLDemo;
// Create an MLContext instance, which serves as the entry point to ML.NET functionality
var mlContext = new MLContext();
// Load the data from a file using the CustomerChurn class's LoadIDataViewFromFile method
// It loads the data for retraining a machine learning model for customer churn prediction
var data = CustomerChurn.LoadIDataViewFromFile(mlContext, CustomerChurn.RetrainFilePath, CustomerChurn.RetrainSeparatorChar, CustomerChurn.RetrainHasHeader);
{
"age": 22,
"gender": "Female",
"tenure": 25,
"usage_Frequency": 14,
"support_Calls": 4,
"payment_Delay": 27,
"subscription_Type": "Basic",
"contract_Length": "Monthly",
"total_Spend": 598,
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
c.RoutePrefix = string.Empty; // <--------Add this line.
});
[ApiController]
[Route("api/[controller]")]
public class TodosController : Controller
{
[HttpGet("/")]
// [ProducesResponseType(typeof(Todo), StatusCodes.Status200OK)]
[ProducesResponseType<Todo>(StatusCodes.Status200OK)]
public Todo Get() => new Todo(1, "Write a sample", DateTime.Now, false);
}
var connection = new signalR.HubConnectionBuilder()
.withUrl("/chatHub")
.withServerTimeoutInMilliseconds(60000)
.withKeepAliveIntervalInMilliseconds(30000)
.build();