Skip to content

Instantly share code, notes, and snippets.

@TheYkk
TheYkk / echo_tracing.go
Created December 8, 2023 21:24
Go echo otel
package tracing
import (
"context"
"fmt"
"os"
"sync"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
@TheYkk
TheYkk / conventional_commit_messages.md
Created November 4, 2021 22:38 — forked from qoomon/conventional_commit_messages.md
Conventional Commit Messages

Conventinal Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@TheYkk
TheYkk / vault_api_transit_secrets.md
Created October 29, 2021 13:51 — forked from ruanbekker/vault_api_transit_secrets.md
Vault: Create Secrets with Vaults Transits Secret Engine

Description

Vault's transit secrets engine handles cryptographic functions on data-in-transit. Vault doesn't store the data sent to the secrets engine, so it can also be viewed as encryption as a service

Enable:

Enable transit secret engine using the /sys/mounts endpoint:

@TheYkk
TheYkk / Makefile
Created July 21, 2021 20:24 — forked from thomaspoignant/Makefile
My ultimate Makefile for Golang Projects
GOCMD=go
GOTEST=$(GOCMD) test
GOVET=$(GOCMD) vet
BINARY_NAME=example
VERSION?=0.0.0
SERVICE_PORT?=3000
DOCKER_REGISTRY?= #if set it should finished by /
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true
GREEN := $(shell tput -Txterm setaf 2)
@TheYkk
TheYkk / Makefile
Created July 21, 2021 20:24 — forked from thomaspoignant/Makefile
My ultimate Makefile for Golang Projects
GOCMD=go
GOTEST=$(GOCMD) test
GOVET=$(GOCMD) vet
BINARY_NAME=example
VERSION?=0.0.0
SERVICE_PORT?=3000
DOCKER_REGISTRY?= #if set it should finished by /
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true
GREEN := $(shell tput -Txterm setaf 2)
// NewWrapResponseWriter wraps an http.ResponseWriter, returning a proxy that allows you to
// hook into various parts of the response process.
func NewWrapResponseWriter(w http.ResponseWriter, protoMajor int) WrapResponseWriter {
_, fl := w.(http.Flusher)
bw := basicWriter{ResponseWriter: w}
if protoMajor == 2 {
_, ps := w.(http.Pusher)
if fl && ps {
@TheYkk
TheYkk / aws-region-names.go
Created May 10, 2021 21:19 — forked from c1982/aws-region-names.go
AWS region names with bill region names
type AwsRegion struct {
Region string
Location string
Code string
A1 string
}
var (
regions = []AwsRegion{
package main
import (
"context"
"flag"
image2 "github.com/aquasecurity/fanal/artifact/image"
"github.com/aquasecurity/fanal/cache"
"github.com/aquasecurity/fanal/image"
dbTypes "github.com/aquasecurity/trivy-db/pkg/types"
"github.com/aquasecurity/trivy/pkg/log"
@TheYkk
TheYkk / test.sh
Created February 1, 2021 10:28 — forked from developer-guy/test.sh
Display Kubernetes OpenAPI Spec
#!/usr/bin/env bash
set -e
# Proxy minikube to localhost on arbitrary port:
kubectl proxy --port=8080 &
sleep 3
# Now swagger.json is available at localhost:12345/openapi/v2
# Save to /tmp/temp/json and serve with e.g. docker swagger-ui container
curl http://localhost:8080/openapi/v2 > /tmp/temp.json
docker container run -d -p 9999:8080 -e SWAGGER_JSON=/var/specs/temp.json -v /tmp/temp.json:/var/specs/temp.json swaggerapi/swagger-ui
@TheYkk
TheYkk / download.sh
Last active September 15, 2020 12:08
Download private youtube list as mp3
while IFS= read -r config; do
a=($(echo $config | tr '=' "\n"))
if ls *$a[2]* 1> /dev/null 2>&1; then
echo "files do exist"
else
youtube-dl -x --audio-format mp3 $config
fi
done< <(jq -c -r '.[]' < 32file.json)