Skip to content

Instantly share code, notes, and snippets.

View hartmannr76's full-sized avatar

Ricky Hartmann hartmannr76

View GitHub Profile
@hartmannr76
hartmannr76 / .gitconfig
Created August 16, 2019 12:04
Gitconfig
[alias]
pr = "!f() { \
open https://github.com/$(git config remote.origin.url | \
sed -e 's/^https:\\/\\/github.com\\///' -e 's/.git$//')/compare/$(git rev-parse --abbrev-ref HEAD)?expand=1; \
};f"
[core]
editor = code --wait
@hartmannr76
hartmannr76 / Dockerfile
Last active July 7, 2018 14:24
.NET Docker configuration for multiple containers in a single repo with a dev configuration for debugging
FROM microsoft/dotnet:2.1.300-sdk as base
ARG APP_SOURCE
WORKDIR /app/code
COPY Directory.Build.props /app
COPY ./src/ /app/code/
RUN dotnet restore ./${APP_SOURCE}/${APP_SOURCE}.csproj
@hartmannr76
hartmannr76 / Dockerfile
Created May 22, 2018 13:00
Egress tracing for calling to external service
FROM envoyproxy/envoy:latest as proxy
RUN apt-get update
RUN apt-get -y install curl
CMD /usr/local/bin/envoy -c /etc/service-envoy.yaml --service-cluster servicemain
@hartmannr76
hartmannr76 / ControllerContextFilter.cs
Created April 16, 2018 08:49
.NET Core Action Filter With Controller Context
public class ControllerContextFilter : IAsyncActionFilter
{
public ControllerContextFilter() { }
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
// Sample captures response time for controller/actions
var sw = new Stopwatch();
sw.Start();
@hartmannr76
hartmannr76 / ContractAttribute.cs
Created March 3, 2018 14:39
Swashbuckle IDocumentFilter that only includes attributed classes. This is good for documenting message bus messages
using System;
[AttributeUsageAttribute(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public class ContractAttribute : Attribute {}
@hartmannr76
hartmannr76 / README.md
Last active October 23, 2023 20:10
Flyway/Postgres Migration with Docker

Running

docker-compose -f docker-compose.migration.yml run flyway /opt/scripts/migrate.sh