Skip to content

Instantly share code, notes, and snippets.

View jesusvazquez's full-sized avatar
Leaving footprints all over

Jesus Vazquez jesusvazquez

Leaving footprints all over
View GitHub Profile
jesusvazquez /
Created June 4, 2024 09:14
test write otlp metric with curl
now=$(date +%s)
\"resourceMetrics\": [
\"resource\": {
\"attributes\": [
\"key\": \"\",
jesusvazquez /
Created January 14, 2022 11:52
Mermaid Test
graph TD
    A[Me] -->|Testing mermaid on| B(Github)

Test mermaid

graph TD
A[Cortex GW] -->|GET| B(Querier)
B --> |Key Config| C(GCS)
C --> |Config| B
B -->|Config| A
# shellcheck disable=SC2086
set -eou pipefail
jesusvazquez /
Created March 10, 2020 12:23
Resolve DNS with exponential backoff
# vim: ai:ts=8:sw=8:noet
# set -eufo pipefail
export SHELLOPTS # propagate set to children by default
# Performs a DNS resolution and waits until the answer has a non-empty response
function resolve_dns_with_backoff {
local timeout=${DNS_RESOLUTION_TIMEOUT-5}
local domain=${1}
jesusvazquez / pipes.go
Created March 4, 2020 21:02
Know if a go program is receiving stdin input or not
package main
import (
func main() {
jesusvazquez /
Created May 11, 2019 19:35 — forked from Kartones/
PostgreSQL command line cheatsheet


Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
jesusvazquez /
Last active May 7, 2019 17:21
Go tools for development
# Tools for developing using go
go get
go get
go get
jesusvazquez /
Last active April 16, 2019 18:22
Migrate golang project from dep to go mod
# Quick list of steps to initialize go mod in your go project.
# Make sure to do this out of the GOPATH or play around with GO111MODULE env var
# Initialize project
go mod init<repository_path>/<project_name>
go build -o /tmp/main main.go
rm /tmp/main
# Remove traces of dep
rm -rf vendor
rm Gopkg.*
# Verify dependencies are there
jesusvazquez /
Created March 5, 2019 10:25
Prometheus Cheatsheet
  • Metric cardinality

count by(__name__) ({__name__=~".*"})