Skip to content

Instantly share code, notes, and snippets.

William Hallatt williamhallatt

Block or report user

Report or block williamhallatt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
williamhallatt / logger.ts
Last active Apr 25, 2019
Winston TypeScript Logger
View logger.ts
import * as config from "config";
import { Logger, LoggerInstance, LoggerOptions, transports } from "winston";
const defaultLevel = process.env.LOG_LEVEL;
// We might want to do something on rotation?
// rotateTransport.on("rotate", (oldFilename, newFilename) => {
// // do something fun
// });
View centos7-systemd-docker-demo-dockerfile
FROM centos:7
# This bit is exactly as per the documentation and can be stuck
# existing Dockerfiles without issue
ENV container docker
RUN (cd /lib/systemd/system/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/*; \
williamhallatt /
Created May 30, 2017 — forked from btroncone/
A Comprehensive Introduction to @ngrx/store - Companion to Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

williamhallatt / cloudSettings
Last active Aug 21, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
View AuthorisationPolicyConfigureJwtBearer.cs
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
// ..........
const string domain = "http://localhost:16137/";
const string secretKey = "needtogetthisfromsomewheresafeandsecure";
var securityKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(secretKey));
var tokenValidationParameters = new TokenValidationParameters
View AuthorisationPolicyIndex.html
<!-- There is some style stuff here... -->
<h2>Valid User With Serious Claims Section</h2>
<button type="button" onclick="validUserWithSeriousClaimsLogin()">Log in as Valid User With Serious Claims!</button>
<br />
<button type="button" onclick="requestValidUserWithSeriousClaimsData()">Request Valid User With Serious Claims data</button>
View AuthorisationPolicyResourceController.cs
[Authorize(Policy = "OnlyValidUsers")]
public class ResourceController : Controller
[Authorize(Policy = "ValidUserWithSeriousClaims")]
public IActionResult ValidUserWithSeriousClaimsData()
return new OkObjectResult("Hello Valid User With Serious Claims, " +
"this is your data speaking!");
View AuthorisationPolicyAccountController.cs
public class AccountController : Controller
private readonly SigningCredentials _signingCredentials;
private readonly JsonSerializerSettings _serializerSettings;
public AccountController()
var securityKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes("needtogetthisfromsomewheresafeandsecure"));
_signingCredentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);
View ConfigureAuthorisationPolicies.cs
public void ConfigureServices(IServiceCollection services)
// ..........
// Set up authorisation policies.
services.AddAuthorization(options =>
policy =>
You can’t perform that action at this time.