Skip to content

Instantly share code, notes, and snippets.

Avatar

Vinicius Niche Correa vniche

View GitHub Profile
@vniche
vniche / docker-compose.yaml
Created June 28, 2021 13:37
Local Development Kafka with Control Center (Docker Compose)
View docker-compose.yaml
---
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
View main.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
View docker-compose.yaml
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
View Makefile
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
View monitored-minikube.sh
# 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
View jaeger-operator.yaml
---
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
View kube-prometheus-setup.yaml
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:
View jaeger-all-in-one-template.yml
#
# 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
@vniche
vniche / resolver.go
Created March 9, 2020 13:11
Implemented endpoints for Getting Started with GraphQL + Golang (in 5 minutes)
View resolver.go
...
func (r *mutationResolver) Signup(ctx context.Context, input NewUser) (string, error) {
user := &User{
ID: uuid.New().String(),
Name: input.Name,
Surename: input.Surename,
CreatedAt: time.Now().String(),
}
// removes oldest user if users length is over 30
@vniche
vniche / main.go
Created March 9, 2020 01:16
Global in-memory storage for GraphQL in Golang
View main.go
...
"github.com/artemis-tech/sample-graph/graph"
)
func main() {
port := "3030"
if os.Getenv("PORT") != "" {
port = os.Getenv("PORT")
}