Skip to content

Instantly share code, notes, and snippets.

View domingoladron's full-sized avatar
💭
alive

Chris Laine domingoladron

💭
alive
View GitHub Profile
@domingoladron
domingoladron / aspnetcore.webapiconventions.oldway.cs
Last active May 22, 2020 23:28
aspnetcore.webapiconventions.oldway.cs
[HttpGet]
public async Task<ActionResult<IEnumerable<WeatherForecast>>> GetAsync()
{
var rng = new Random();
var notFound = false;
var response = Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
@domingoladron
domingoladron / plantuml-component-diagram.puml
Created April 12, 2020 02:56
PlantUML Slightly Less Simple Component Diagram
@startuml
title ECS Fargate API and Aurora MySQL
cloud Internet {
}
node "ECS Cluster" {
node "ECS Fargate Service" {
node "ECS Task" {
@domingoladron
domingoladron / plantuml-sequence-diagram.puml
Created April 12, 2020 02:30
PlantUML Simple Sequence Diagram
@startuml Simple Sequence Diagram
title Simple Sequence Diagram Example
actor Chris
boundary PlantUMLServer
Chris->PlantUMLServer: Edit PlantUML Code
PlantUMLServer->PlantUMLServer: Process Code
alt Chris' PlantUML Code is wrong
PlantUMLServer -> Chris: Syntax error, goofball!
@domingoladron
domingoladron / pulumi-ecs-fargate-example-task-definition.ts
Created April 10, 2020 23:19
pulumi-ecs-fargate-example-task-definition.ts
//create our ecs task (with docker build of our container)
const taskDefinition = new awsx.ecs.FargateTaskDefinition("pulumi-ecs-primary", {
containers: {
sampleapp: {
image: awsx.ecs.Image.fromDockerBuild(repo, {
context: "../src/",
dockerfile: "../src/MyApi/MyApi.Service/AWS.Dockerfile",
}),
portMappings: [listener],
//we can even add environment variables to our task's container
@domingoladron
domingoladron / aspnetcore.toggleauth.startup.configure.cs
Created March 17, 2020 01:57
aspnetcore.toggleauth.startup.configure.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLifetime)
{
//Your other configuration
//Use Identity and Access Control, if enabled
if (bool.Parse(Configuration["AUTHENTICATION_ENABLED"] ?? "true"))
{
app.UseAuthentication();
}
@domingoladron
domingoladron / aspnetcore.toggleauth.startup.configureservices.cs
Created March 17, 2020 01:54
aspnetcore.toggleauth.startup.configureservices.cs
public void ConfigureServices(IServiceCollection services)
{
//Other configuration above...
if (bool.Parse(Configuration["AUTHENTICATION_ENABLED"] ?? "true"))
{
//add all your authentication setup logic here
services.AddMvcCore(options => options.EnableEndpointRouting = false)
.AddAuthorization();
@domingoladron
domingoladron / aspnetcore.toggleauth.docker-compose.yml
Created March 17, 2020 01:43
aspnetcore.toggleauth.docker-compose.yml
version: "3.4"
services:
price-predict:
image: my-api
build:
context: .
dockerfile: My.Api/LOCAL.Dockerfile
environment:
- ASPNETCORE_ENVIRONMENT=Development
- AUTHENTICATION_ENABLED=true|false
@domingoladron
domingoladron / Bitbucket-pipeline-api-docker-override.yml
Created February 26, 2020 04:59
Bitbucket-pipeline-api-docker-override.yml
version: "3.4"
services:
my-api:
extra_hosts:
- mysql:${BITBUCKET_DOCKER_HOST_INTERNAL}
@domingoladron
domingoladron / Bitbucket-pipeline-mysql-service.yml
Last active February 26, 2020 04:45
Bitbucket-pipeline-mysql-service.yml
definitions:
steps:
- step: &run-postman-tests
name: Run postman tests collections
image: node:13.1.0-alpine3.10
services:
- docker
- mysql
caches:
- dotnetcore
@domingoladron
domingoladron / aws-cli-query-output-to-variable.sh
Created February 12, 2020 03:23
aws-cli-query-output-to-variable.sh
REPO_TO_DELETE=$( aws ecr describe-repositories --query "repositories[0].[repositoryName]" --output text)
echo $REPO_TO_DELETE
# Now pass this to your next command, as in
# aws ecr delete-repository --repository-name $REPO_TO_DELETE