Skip to content

Instantly share code, notes, and snippets.

View anderson-marques's full-sized avatar
🤖
Hacking as usual...

Anderson Carvalho anderson-marques

🤖
Hacking as usual...
View GitHub Profile
@anderson-marques
anderson-marques / Makefile
Last active February 20, 2021 16:15
Dockerized .NET - Makefile
build-dev:
@docker build -f ./docker/dev/Dockerfile -t dockerized-dotnet:dev .
tag=1.0.0
build-prod:
@docker build -f ./docker/prod/Dockerfile -t dockerized-dotnet:${tag} .
@docker tag dockerized-dotnet:${tag} dockerized-dotnet:latest
console: build-dev
@docker run --rm -it dockerized-dotnet:dev sh
@anderson-marques
anderson-marques / Dockerfile
Created February 20, 2021 14:43
Dockerized .NET - Development Image
FROM mcr.microsoft.com/dotnet/sdk:3.1-alpine
ENV WORKDIR /app
WORKDIR ${WORKDIR}
COPY dockerized-dotnet.csproj .
RUN dotnet restore
COPY . .
@anderson-marques
anderson-marques / Dockerfile
Created February 20, 2021 14:27
dockerized-dotnet-Dockerfile
FROM mcr.microsoft.com/dotnet/sdk:3.1-alpine AS step1
WORKDIR /src
COPY dockerized-dotnet.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish -c release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:3.1-alpine
WORKDIR /app
COPY --from=step1 /app .
@anderson-marques
anderson-marques / dockerizing_dotnet_init.sh
Created February 20, 2021 13:45
Creates a new .NET Project in the host using Docker
project_name=dockerized-dotnet
init_command="dotnet new webapi -o ${project_name} --no-https"
docker_image=mcr.microsoft.com/dotnet/sdk:3.1-alpine
docker run --rm -td --name "${project_name}-init" "${docker_image}" sh -c "${init_command} && sleep 60"
sleep 20
docker cp ${project_name}-init:/${project_name} .
@anderson-marques
anderson-marques / pyenv.sh
Created February 19, 2021 11:45
MACos Pyenv setup
PYENV_PYTHON_VERSION=3.1
brew install pyenv
pyenv install $PYENV_PYTHON_VERSION
pyenv global $PYENV_PYTHON_VERSION
pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc
@anderson-marques
anderson-marques / cdc-event.json
Created February 13, 2021 14:24
Debezium CDC Event
{
"schema": {...},
"payload": {
"before": {
"id": 1004,
"first_name": "Anne Marie",
"last_name": "Kretchmar",
"email": "[email protected]"
},
"after": null,
@anderson-marques
anderson-marques / Cafeteira.java
Last active February 1, 2021 21:04
Cafeteira com MelMaple
public class Cafeteira {
public static void main( String[] args )
{
System.out.println( "Bem vindo ao Cafe Liskov!" );
Cafe cafezinho = new Cafe();
Adocante melMaple = new MelMaple();
cafezinho.adicionarAdocante(melMaple);
@anderson-marques
anderson-marques / MelMapple.java
Created February 1, 2021 21:02
MelMapple.java
public class MelMaple extends Mel {
@Override
public void adocar(Bebida bebida) {
bebida.saborAdocicado += 3;
}
}
@anderson-marques
anderson-marques / CafeECafeteiraMelhoradas.java
Created February 1, 2021 21:00
CafeECafeteiraMelhoradas
public class Cafe extends Bebida {
public void adicionarAdocante(Adocante adocante) {
adocante.adocar(this);
}
}
public class Cafeteira {
public static void main( String[] args )
{
System.out.println( "Bem vindo ao Cafe Liskov!" );
@anderson-marques
anderson-marques / ClassesExemplo.java
Created February 1, 2021 20:58
ClassesExemplo.java
public interface Adocante {
public void adocar(Bebida b);
}
public class AcucarComum implements Adocante {
@Override
public void adocar(Bebida bebida) {
bebida.saborAdocicado+=1;
}
}