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@email.com>"
// write/quit vi
git rebase --continue // <- repeat until all edited commits complete
git push -f

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>

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)’),)’: /simple/pylint/ >>>>>>>> Could not fetch URL https://pypi.python.org/simple/setuptools/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=’pypi.python.org’, port=443): Max retries exceeded with url: /simple/setuptools/ (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)’),)) – skipping



// add the following flag to the pip command:

--trusted-host files.pythonhosted.org --trusted-host pypi.org

// or wherever the error indicates a problem in

<error message>... HTTPSConnectionPool(host='pypi.python.org', port=443)

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%

Fix “is not digitally signed” powershell error

#Open powershell as administrator
Get-ExecutionPolicy -List
         Scope               ExecutionPolicy
         -----               ---------------
 MachinePolicy               Undefined
    UserPolicy               Undefined
       Process               Unrestricted
   CurrentUser               Unrestricted
  LocalMachine               Unrestricted

#Set all to Unrestricted where allowed. The first two are usually managed by group policy.

Set-ExecutionPolicy Unrestricted -Scope Process
#type Y and press enter