XSRF or CSRF with Angular and Dot Net Core Web API Mar 21, 2019

Turns out adding XSRF, CSRF, See-Surf or whatever the name we call it now to an Angular app with a .NET Core Web API is really really easy.

...
How to Optimize All JPG and PNG Files in a Folder Using the Windows Command Line Feb 10, 2019

Images on the internet should always be optimized where possible to reduce the load time of your websites. Of course the best solution is to use a CDN but sometimes for whatever reason like me you inherit some folders full of unoptimized images you can run the following commands to reduce the load on your server. These could also be added to batch files and run in the scheduler if required.

...
How to Add Microsoft's Console Log Provider to .Net Core 2.2 Console Application using the built-in Service Provider Feb 1, 2019
  1. Starting with an empty .NET Core Console Application add the following packages:
Microsoft.Extensions.DependencyInjection
Microsoft.Extensions.Logging
Microsoft.Extensions.Logging.Console
  • Instantiate Microsoft’s Dependecy Injection Service Provider.
var serviceProvider = new ServiceCollection().BuildServiceProvider();
  • Register the Console Logging Provider dependency with the Service Provider using Microsoft’s extension methods
var serviceProvider = new ServiceCollection().AddLogging(cfg => cfg.AddConsole()).BuildServiceProvider();

By default the lifetime of the logging service is set to Singleton.

...
Decommissioning Old Databases Jan 3, 2019

Occasionally I inherit an old development database server containing many databases and I usually have no idea which are no longer in use. I came across the following script that allows you to see the last time a database was accessed:

...
Find Pair With Given Sum in Array Dec 5, 2018

As I’m moving more and more into management I need ways to keep my coding foo fresh so I have taken to solving small problems from various sites on the internet in my spare time. I also miss that feeling of being in the zone and fully engaged in something just difficult enough to stretch myself.

...
Hugo - Failed to find a valid digest in the 'integrity' attribute for resource Dec 5, 2018

After cloning my Hugo site to a new machine and running:

...
Hugo NoSuchKey on Sub Folders After Deploying to Amazon S3 and CloudFront Oct 13, 2018

After deploying this blog to Amazon S3 with CloudFront the main page rendered correctly but any pages in sub folders like /posts or /posts/post-vanity-url would recieve the following error:

...
Building Hugo Extended on AWS CodeBuild Oct 11, 2018

After upgrading my Hugo theme to the Hyde inspired Hyde-Hyde theme I also needed to switch from the standard Hugo build to the extended build in order to use the pipes feature.

...
Open ID & OAUTH 2.0 Sep 4, 2017

I do security work often but not often enough that I don’t end up Googling many of the terms and concepts every time. Here is a list of the best articles as a quick goto:

...
Quick SSL Certs For Local IIS Development Aug 23, 2017

You can use selfssl from the IIS 6 Resource Kit to quickly add self signed SSL certs for local development.

...