Skip to content

Instantly share code, notes, and snippets.

View vniche's full-sized avatar

Vinicius Niche Correa vniche

View GitHub Profile
@vniche
vniche / traefik.yml
Last active November 22, 2023 13:53
Traefik Docker integration config
providers:
docker: {}
accessLog: {}
api:
insecure: true
@vniche
vniche / main.go
Created October 20, 2023 21:34
2sum leetcode challenge
func twoSum(nums []int, target int) []int {
for index, number := range nums {
if index == len(nums)-1 {
break
}
for secondIndex, secondNum := range nums[index+1:] {
if number + secondNum == target {
return []int{index, (index+1)+secondIndex}
}
@vniche
vniche / docker-compose.yaml
Created June 28, 2021 13:37
Local Development Kafka with Control Center (Docker Compose)
---
version: "3.9"
services:
zookeeper:
image: confluentinc/cp-zookeeper:6.2.0
hostname: zookeeper
container_name: zookeeper
ports:
- "2181:2181"
environment:
@vniche
vniche / main.go
Created June 6, 2021 02:16
How to decrypt a EC password encrypted private key in Go
...
privateKeyBytes, err := ioutil.ReadFile("/path/to/my/private.key")
if err != nil {
log.Fatalf("failed to read private key file: %v", err)
}
block, _ := pem.Decode(privateKeyBytes)
if err != nil {
log.Fatalf("failed to decode private key to PEM: %v", err)
}
@vniche
vniche / docker-compose.yaml
Last active April 20, 2021 01:04
HAProxy configuration for Raspiberry Pi container cluster SubStack series
version: "3.9"
services:
haproxy:
image: haproxy:lts
container_name: haproxy
user: 1000:1000
ports:
- 80:8080
- 443:8443
@vniche
vniche / Makefile
Created April 18, 2021 19:57
Sample application for Raspiberry Pi container cluster
build-with-docker:
docker run -it --rm \
-v $(shell pwd):/go/src/github.com/vniche/armv6-sample-app \
-w /go/src/github.com/vniche/armv6-sample-app \
--platform linux/arm/v6 \
golang:1.15-buster go build -o sample-app .
@vniche
vniche / monitored-minikube.sh
Last active August 23, 2020 15:57
all-in-one monitored minikube K8S provisioning script
# start minikube k8s
minikube delete
minikube start --kubernetes-version=v1.18.1 --memory=6g \
--bootstrapper=kubeadm --extra-config=kubelet.authentication-token-webhook=true \
--extra-config=kubelet.authorization-mode=Webhook --extra-config=scheduler.address=0.0.0.0 \
--extra-config=controller-manager.address=0.0.0.0 --driver=docker
# disable k8s metrics-server as it is going to be served by prometheus
minikube addons disable metrics-server
@vniche
vniche / jaeger-operator.yaml
Last active August 22, 2020 23:46
jaeger-operator manifests to provision to a minikube K8S
---
apiVersion: v1
kind: Namespace
metadata:
name: observability
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
@vniche
vniche / kube-prometheus-setup.yaml
Last active August 22, 2020 23:38
kube-prometheus manifests to provision to a minikube K8S
This file has been truncated, but you can view the full file.
---
apiVersion: v1
kind: Namespace
metadata:
name: monitoring
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
#
# Copyright 2017-2019 The Jaeger Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express