Skip to content

Instantly share code, notes, and snippets.

View georgekosmidis's full-sized avatar

George Kosmidis georgekosmidis

View GitHub Profile
@georgekosmidis
georgekosmidis / bash-semver-regexp
Created March 20, 2023 08:58
Suggested regular expression (RegEx) to check a SemVer string for BASH, as described in https://semver.org/
# Suggested regular expression (RegEx) to check a SemVer string for BASH
# as described in https://semver.org/
# Test here: https://regex101.com/r/qfrSak/1
^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$
{
//...
"WeatherWidgetSettings": {
"OpenWeatherApiKey": "XXXXXXXXXXXXXXXXXXXXXXXXXX"
},
//...
}
public class PriceSet
{
[BsonId]
public Guid Id { get; init set; }
public decimal Price { get; init set; }
//...
}
[Obsolete($"Call {nameof(Discard)} instead")]
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
//...
public void ConfigureServices(IServiceCollection services)
public class EarlyBindingSample
{
public void RandomMethod()
{
//...
}
}
var earlyBinding = new EarlyBindingSample();
var trainer = mlContext.BinaryClassification.Trainers
.AveragedPerceptron(labelColumnName: "Sentiment", featureColumnName: "Features"));
var trainingPipeline = dataTransformPipeline.Append(trainer);
public partial class MariaDbContext : Microsoft.EntityFrameworkCore.DbContext
{
public MariaDbContext(DbContextOptions<MariaDbContext> options)
: base(options)
{
}
public virtual DbSet<WeatherForecastDataModel> WeatherForecasts { get; set; }
}
public void ConfigureServices(IServiceCollection services)
{
//...
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen();
//...
}
# This is a sample Dockerfile for building and running ASP.NET Core applications
# This is part of the cheat sheet at https://blog.georgekosmidis.net/2020/06/12/docker-cheat-sheet-for-dotnet-core/
# Pull ASP.NET Core 3.1 runtime and give the name 'base'
# More info on 'FROM' instruction here: https://docs.docker.com/engine/reference/builder/#from
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
# Set the ports where the container listens at runtime
# More on the 'EXPOSE' instruction here: https://docs.docker.com/engine/reference/builder/#workdir
EXPOSE 80