Skip to content

Instantly share code, notes, and snippets.

View ulexxander's full-sized avatar
💪
Workin hard

Alexander Ustyugov ulexxander

💪
Workin hard
View GitHub Profile
@ulexxander
ulexxander / metrics.go
Created January 11, 2023 20:34
Go test utility to dump Prometheus metrics observed during the test.
package testutil
import (
"bytes"
"flag"
"os"
"testing"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/expfmt"
@ulexxander
ulexxander / algs_test.go
Last active January 14, 2023 18:29
Go JWT library `golang-jwt/jwt` comparison of different signing algorithms
//nolint:forbidigo,dupl
package jwt_test
import (
"crypto/ecdsa"
"crypto/ed25519"
"crypto/elliptic"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@ulexxander
ulexxander / envcompare_test.go
Created January 16, 2023 13:50
Comparing few Go libraries for scanning environment variables into structs
package envcompare_test
import (
"net"
"testing"
"github.com/caarlos0/env/v6"
envsimpler "github.com/go-simpler/env"
"github.com/kelseyhightower/envconfig"
"github.com/sirupsen/logrus"
@ulexxander
ulexxander / wsl-setup.md
Last active July 17, 2023 08:14
Setting up and troubleshooting WSL2 development environment.
@ulexxander
ulexxander / cloud-init.yaml
Last active July 5, 2023 05:08
Basic Kubernetes installation snippets
#cloud-config
users:
- name: alex
groups: sudo, docker
shell: /bin/bash
lock_passwd: false
# mkpasswd --method=SHA-512 --rounds=4096
passwd: "$6$rounds=4096$liX9KRchDIBKuoXt$LqW34rkz2k3yB/MmSPL4SbvGmO0xg7sQKgnwkTAhTV6RjvZAOJS9G4iURlkJS63TRt.ThpE9Thy9G/1.JwXDC0"
ssh_authorized_keys:
@ulexxander
ulexxander / docker-compose.yml
Last active July 20, 2023 07:35
Prometheus / Grafana / Node Exporter and Docker SD
version: "3.8"
services:
prometheus:
image: prom/prometheus:v2.45.0
command:
- "--web.enable-admin-api"
ports:
- "9090:9090"
volumes:
@ulexxander
ulexxander / prometheus-docker-sd.yml
Last active September 17, 2023 20:13
Prometheus docker_sd relabel configs to be able to use prometheus.io scrape, path and port container labels, just like we do in Kubernetes!
global:
scrape_interval: 10s
scrape_configs:
- job_name: docker_sd
docker_sd_configs:
- host: unix:///var/run/docker.sock
refresh_interval: 10s
@ulexxander
ulexxander / oauth2-proxy-gitlab-docker-compose.yml
Created September 21, 2023 20:10
OIDC Proxying Docker container using oauth2-proxy.
services:
prometheus-proxy:
image: quay.io/oauth2-proxy/oauth2-proxy:v7.5.0
command:
- --http-address=:4180
- --upstream=http://prometheus:9090
- --email-domain=*
- --oidc-issuer-url=https://gitlab.com
- --provider=gitlab
- --redirect-url=http://prometheus-oauth.localhost/oauth2/callback
@ulexxander
ulexxander / ngrok-docker-compose.yml
Last active October 12, 2023 09:40
Ngrok in Docker for projects development
version: "3.8"
services:
my-app:
image: nginx:1.25.2
ngrok:
image: ngrok/ngrok:3.3.5-alpine
command:
- http