Skip to content

Instantly share code, notes, and snippets.

View rafaeldalsenter's full-sized avatar
🚀

Rafael Dalsenter rafaeldalsenter

🚀
  • Brazil
View GitHub Profile
@rafaeldalsenter
rafaeldalsenter / Dockerfile_trimming_singlefile.dockerfile
Created August 10, 2022 14:27
Dockerfile using self-contained Trimming
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS publish
WORKDIR /
COPY ["WebApi/WebApi.csproj", "WebApi/"]
RUN dotnet restore "WebApi/WebApi.csproj" --runtime alpine-x64
COPY . .
RUN dotnet publish "WebApi/WebApi.csproj" -c Release -o /app/publish \
--no-restore \
--runtime alpine-x64 \
--self-contained true \
@rafaeldalsenter
rafaeldalsenter / Dockerfile
Last active August 10, 2022 12:47
Dockerfile using trimming for .NET web applications
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS publish
WORKDIR /
COPY */*.csproj .
RUN for file in $(ls *.csproj); do mkdir -p ${file%.*}/ && mv $file ${file%.*}/; done
COPY *.sln .
RUN dotnet restore --runtime alpine-x64
COPY . .
RUN dotnet publish "WebApi/WebApi.csproj" -c Release -o /app/publish \
--no-restore \
@rafaeldalsenter
rafaeldalsenter / keycloak_istio.yaml
Created December 9, 2021 20:11
Keycloak and Istio authentication
apiVersion: security.istio.io/v1beta1
kind: RequestAuthentication
metadata:
name: auth
namespace: istio-system
spec:
selector:
matchLabels:
app: istio-ingressgateway
jwtRules:
@rafaeldalsenter
rafaeldalsenter / NoSqlMongoConnection.cs
Created July 8, 2021 13:22
Mongo query: C# Example
using MongoDB.Driver;
var client = new MongoClient("mongodb://Ip1,Ip2");
var ret = client.GetDatabase("example")
.GetCollection<ExampleCollection>("example_collection");
@rafaeldalsenter
rafaeldalsenter / NoSqlCassandraConnection.cs
Created July 8, 2021 13:14
Cassandra query: C# Example
using Cassandra;
...
var cluster = Cluster.Builder()
.AddContactPoints("Ip 1", "Ip 2" ...)
.WithPort(9042)
.Build();
var conn = cluster.Connect();
@rafaeldalsenter
rafaeldalsenter / value_jenkins_secret.groovy
Created June 23, 2021 12:17
Get Jenkins secret value
// Get the value from Secret text in "Manage credentials" page. Capture from F12 option ;)
println hudson.util.Secret.decrypt("value")
@rafaeldalsenter
rafaeldalsenter / docker-compose-cassandra.yaml
Last active June 30, 2021 20:15
NoSQL databases benchmark
version: '3'
services:
first-cassandra:
image: cassandra
hostname: first-cassandra
restart: on-failure
container_name: first-cassandra
expose:
- 9042
ports:
FROM rafaeldalsenter/k8s-cloud-deploy:1.0
ENV PROJECT_ID=test-project
ENV REGION=us-west1
ENV CLOUD=gcp
# This "." folder contains K8s files and CREDENTIALS.json
COPY . /app
@rafaeldalsenter
rafaeldalsenter / docker-compose-kafka-connect.yml
Last active November 11, 2020 00:54
Docker-compose to Kafka single-node + Kafka Connect
---
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
hostname: zookeeper
container_name: zookeeper
ports:
- "2181:2181"
environment:
public async Task<IList<PullRequestFileDto>> GetFilesFromPullRequest(long repositoryId, int pullRequest)
{
var result = await _githubClient.PullRequest.Files(repositoryId, pullRequest);
return result.Select(x => new PullRequestFileDto
{
Additions = x.Additions,
Deletions = x.Deletions,
Path = x.Patch,
FileName = x.FileName