Skip to content

Instantly share code, notes, and snippets.


Chris S. yetanotherchris

View GitHub Profile
yetanotherchris / loading-pem-ssl-windows-workaround.cs
Created Dec 26, 2020
Loading PEM SSL certificates in Kestrel (Windows work-around)
View loading-pem-ssl-windows-workaround.cs
// See
public static class CertHelper
// To generate a self-signed cert:
// dotnet dev-certs https -ep $pwd/selfsigned.pem --format Pem -np
public static X509Certificate2 GetCertificate()
X509Certificate2 sslCert = CreateFromPublicPrivateKey("certs/selfsigned.pem", "certs/selfsigned.key");
yetanotherchris / main.go
Last active Nov 27, 2020
Quote of the day in Go Lang (playing with Go for the first time)
View main.go
package main
import (
yetanotherchris / yarn-env-bars.ps1
Last active Nov 21, 2020
Solution to yarn global add does not work on Windows (command not found)
View yarn-env-bars.ps1
$yarnPath = & yarn global bin
$path = [System.Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("PATH", "$path;$yarnPath", [System.EnvironmentVariableTarget]::User)
# Your yarn path should appear at the end of the path now
[System.Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::User)
# Try a global command, for example gatsby. If you're using Visual Studio Code, you'll need to restart the IDE
yetanotherchris / PublicKeyCryptographyExample.cs
Last active Jun 21, 2021
Public key cryptography by example in .NET Core
View PublicKeyCryptographyExample.cs
using System;
using System.IO;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
namespace PublicKeyCryptographyExample
yetanotherchris / quote-of-the-day.ps1
Created Nov 3, 2020
Quote of the day Powershell script
View quote-of-the-day.ps1
wget "" | Select-Object -Expand Content | ConvertFrom-Json | Select-Object quoteText, quoteAuthor
yetanotherchris / base64-decode-jwt.cs
Last active Sep 15, 2020
Base64 decode a JWT in C# .NET Core
View base64-decode-jwt.cs
// Add the following nuget package for Base64Url decoding:
// dotnet add package Microsoft.AspNetCore.WebUtilities
// This example JWT is taken from
string jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
string[] parts = jwt.Split('.');
foreach (string section in parts)
// The final (3rd) section is the JWT signature, so will appear as nonsense as it isn't JSON
yetanotherchris /
Created Aug 3, 2020
A few AWS command lines
aws s3api create-bucket --bucket MYBUCKET --create-bucket-configuration LocationConstraint=eu-west-1
aws s3api put-object --bucket MYBUCKET --key myfile.txt --body .\myfile.txt
aws dynamodb create-table --table-name {YOURTABLE} &
--attribute-definitions AttributeName={SOME-STRING-ID},AttributeType=S AttributeName={SOME-NUMBER-ID},AttributeType=N &
--key-schema AttributeName={SOME-STRING-ID},KeyType=HASH AttributeName={SOME-NUMBER-ID},KeyType=RANGE &
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
yetanotherchris /
Last active Sep 19, 2019
Vue JS with ASP.NET Core - basic example

Vue JS with ASP.NET Core

These notes come with much appreciation from Packt's ASP.NET Core 2 and Vue.js, adapted for my use.

.NET Core currently (2.2) only ships with a React and Angular project template. There is a Vue one but it uses Typescript and for some unknown reason doesn't compile when you perform a "dotnet run".

Install the dotnet template

  • dotnet new --install Microsoft.AspNetCore.SpaTemplates::*
  • dotnet new vue
yetanotherchris /
Created Sep 8, 2019
Deconstructing views/components/services needed in Roadkill V3

This is based off the UI of Roadkill v2, with no new functionality or design.

Editor view

Global UI elements

These options could be in a hamburger bar:

  1. Page last edited by ____ on _____
  2. Page info dialog - added by + on, last edit by + on, title, tags, dates
yetanotherchris /
Created Jun 26, 2019
visualise github branch history
git log --oneline --graph --decorate --all