Skip to content

Instantly share code, notes, and snippets.

View yetanotherchris's full-sized avatar
馃攺
;每每每每rules

Chris S. yetanotherchris

馃攺
;每每每每rules
View GitHub Profile
@yetanotherchris
yetanotherchris / base64-decode-jwt.cs
Last active September 15, 2020 14:25
Base64 decode a JWT in C# .NET Core
// Add the following nuget package for Base64Url decoding:
// dotnet add package Microsoft.AspNetCore.WebUtilities
// This example JWT is taken from jwt.io
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
yetanotherchris / aws.sh
Created August 3, 2020 12:03
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
yetanotherchris / vue-js-net-core.md
Last active December 21, 2023 18:18
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
yetanotherchris / roadkill-ui-notes.md
Created September 8, 2019 16:48
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
yetanotherchris / git.sh
Created June 26, 2019 15:28
visualise github branch history
git log --oneline --graph --decorate --all
@yetanotherchris
yetanotherchris / gitlog.sh
Last active June 19, 2019 16:06
Git log prettier version
git log -n2 --pretty="format:[%cD] %an : %s"
@yetanotherchris
yetanotherchris / docker-ps.ps1
Created May 3, 2019 09:08
Minimal docker ps
# https://docs.docker.com/engine/reference/commandline/ps/#formatting
docker ps -a --format "table {{.ID}} \t {{.Image}} \t {{.Status}}"
Netmask Netmask (binary) CIDR Notes
_____________________________________________________________________________
255.255.255.255 11111111.11111111.11111111.11111111 /32 Host (single addr)
255.255.255.254 11111111.11111111.11111111.11111110 /31 Unuseable
255.255.255.252 11111111.11111111.11111111.11111100 /30 2 useable
255.255.255.248 11111111.11111111.11111111.11111000 /29 6 useable
255.255.255.240 11111111.11111111.11111111.11110000 /28 14 useable
255.255.255.224 11111111.11111111.11111111.11100000 /27 30 useable
255.255.255.192 11111111.11111111.11111111.11000000 /26 62 useable
255.255.255.128 11111111.11111111.11111111.10000000 /25 126 useable
@yetanotherchris
yetanotherchris / powershell-rename
Created April 24, 2019 13:03
Bulk rename files using Powershell
get-childitem *.PNG | rename-item -NewName { $_.Name.Replace(".PNG", ".png") }
@yetanotherchris
yetanotherchris / roadkill-install.sh
Created April 8, 2019 20:39
Install .NET Core 2.2, Docker for Roadkill V3 on Ubuntu 18
wget -q https://packages.microsoft.com/config/ubuntu/18.10/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get -y install apt-transport-https
sudo apt-get -y update
sudo apt-get -y install dotnet-sdk-2.2
sudo apt-get -y install git
sudo apt-get -y install docker.io
sudo usermod -aG docker $USER.
git clone https://github.com/roadkillwiki/roadkill_new/
sudo docker run -d -p 5432:5432 --name roadkill-postgres -e POSTGRES_USER=roadkill -e POSTGRES_PASSWORD=roadkill postgres