Skip to content

Instantly share code, notes, and snippets.

View dgt0011's full-sized avatar

Darren Tuer dgt0011

  • Brisbane, Australia
View GitHub Profile
@dgt0011
dgt0011 / Program.cs
Created May 22, 2024 10:41
Modified version of the BlazorWebAppOidc.Program.cs file to support using AWS Cognito as the OIDC provider for a ASP.Net Core 8 Blazor sample project from https://learn.microsoft.com/en-us/aspnet/core/blazor/security/blazor-web-app-with-oidc?view=aspnetcore-8.0&pivots=without-bff-pattern
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.JsonWebTokens;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using BlazorWebAppOidc;
using BlazorWebAppOidc.Client.Weather;
using BlazorWebAppOidc.Components;
using BlazorWebAppOidc.Weather;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
AWSTemplateFormatVersion: 2010-09-09
Description: >
Create an AWS Cognito User Pool with a User Group and App Client for securing a web application.
Transform: AWS::Serverless-2016-10-31
Parameters:
sesIdentity:
Description: The SES identity to use for sending emails
Type: String
Default: no-reply@yourorg.com
userPoolName:
@dgt0011
dgt0011 / sonarqube-ecs.yaml
Last active March 24, 2024 05:11
Cloudformation template to deploy SonarQube TO ECS Fargate. Note that this template depends on stacks created from the my-vpc.yaml and rds.yaml gists
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::SecretsManager-2020-07-23
Description: ECS Cluster for SonarQube CE.
Dependent on an RDS instance/stack and a VPC stack.
Parameters:
ServiceName:
Type: String
Default: sonarqube-app
Description: A name for the service.
@dgt0011
dgt0011 / rds.yaml
Created March 24, 2024 00:55
Cloudformation template for a postgreSQL AWS RDS database for use with SonarQube with a generated secret stored in AWS Secrets Manager
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::SecretsManager-2020-07-23
Description: PostgreSQL DB RDS Instance for SonarQube
Parameters:
DBInstanceIdentifier:
Description: Name of the RDS Instance.
Type: String
MinLength: '1'
MaxLength: '255'
Default: sonarqube
@dgt0011
dgt0011 / my-vpc.yaml
Last active March 23, 2024 06:53
Cloudformation template for a simple AWS VPC with three public, three private subnets, IGW, route tables and CF exports for all subnet Ids
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Creates AWS infrastructure for the primary (non default) VPC
Parameters:
VPCOctet:
Description: First two octets of the VPC (e.g. '192.168' for '192.168.0.0/20')
Type: String
MinLength: 4
MaxLength: 7
AllowedPattern: "[0-9]{2,3}.[0-9]{1,3}"
@dgt0011
dgt0011 / postgresdb.yaml
Last active December 11, 2023 22:09
Cloudformation template for a postgreSQL AWS RDS database, optional Multi-AZ deployment, read replica, RDS Proxy, scheduled credential rotation
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::SecretsManager-2020-07-23
Description: PostgreSQL DB RDS Instance
Parameters:
DBInstanceIdentifier:
Description: Name of the RDS Instance.
Type: String
MinLength: '1'
MaxLength: '50'
Default: postgresdb
@dgt0011
dgt0011 / gist:2aa7eaa698f3942abd02d6104d8ef013
Created July 4, 2017 03:13
ATMega328 setup INT0 and INT1 for hardware interrupt on falling edge
//setup INT0 and INT1 for hw int.
DDRD &= ~(1 << DDD2); // Clear the PD2&PD3 pin & enable PD2 & PD3 as input
DDRD &= ~(1 << DDD3);
PORTD |= (1 << PORTD2) | (1 << PORTD3);
//trigger INT0, INT1 on falling edge
EICRA |= (1 << ISC11) | (1<< ISC01);
EIMSK |= (1 << INT0) | (1 << INT1);