Enable CORS in .NET Core Web API

// Startup.cs

public void ConfigureServices(IServiceCollection services)
{
    services.AddCors(options =>
    {
        options
            .AddPolicy("CorsPolicy", builder => builder
            .WithOrigins("http://localhost:4200")
            .AllowAnyMethod()
            .AllowAnyHeader()
            .AllowCredentials());
        });
    }
}

public void Configure(IApplicationBuilder app, IApiVersionDescriptionProvider provider)
{
    app.UseCors("CorsPolicy");
}

edit git commit details

git rebase -i 0abc12def // <- the commit before the one that needs edit
// use vi to change "pick" to "edit" on the commit(s) that need edits, then write/quit
git commit --amend --author="Christopher Snay <[email protected]>"
// write/quit vi
git rebase --continue // <- repeat until all edited commits complete
git push -f

Scaffold a MySql database from .NET Core

PM> Scaffold-DbContext "server=IP.ADD.RE.SS;user=dbuser;password=dbpass;database=dbname" MySql.Data.EntityFrameworkCore -o dbname -f

Requirement:
Microsoft.EntityFrameworkCore.Tools

Different providers:
MySql.Data.EntityFrameworkCore
Microsoft.EntityFrameworkCore.SqlServer

Angular setup

// create new app
ng new <PROJECT_NAME>
cd <PROJECT_NAME>

// install angular material
npm i @angular/material @angular/animations @angular/cdk hammerjs

// generate components
ng g c <COMPONENT_NAME>

// generate services
ng g s <SERVICE_NAME>

compare 2 files with Visual Studio

// open cmd
<<<path to Visual Studio\Common7\IDE>>>devenv /diff file1 file2

Or just create a batch file. Example:

@echo off
echo Drag and drop the first file onto this window. Then press [ENTER]
set /p file1=
echo Drag and drop the second file onto this window. Then press [ENTER]
set /p file2=
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" /diff %file1% %file2%

ssh key generation

ssh-keygen
// copy contents from C:\Users\<<<me>>>\.ssh\id_rsa.pub
// paste contents to: https://bitbucket.org/account/user/<<<me>>>/ssh-keys/

ssh key generation to a specific directory

ssh-keygen -f C:\somepath\filename