Skip to content

Instantly share code, notes, and snippets.

View kushsharma's full-sized avatar
🚀

Kush kushsharma

🚀
  • India
View GitHub Profile
@kushsharma
kushsharma / listen.sh
Created April 17, 2024 14:52
Statsd watcher
# make sure statsd is using localhost:8125 as host
nc -u -l 8125
@kushsharma
kushsharma / pgxv4.go
Created April 17, 2024 11:10
Go: Collecting pgx/v4 prometheus metrics
package metrics
import (
"github.com/jackc/pgx/v4/pgxpool"
"github.com/prometheus/client_golang/prometheus"
)
// PgxPoolStatPromCollector is a Prometheus collector for pgx metrics using prometheus.Collector interface
type PgxPoolStatPromCollector struct {
db *pgxpool.Pool
@kushsharma
kushsharma / README.md
Last active February 21, 2024 09:28 — forked from koshatul/README.md
Use Apple Keychain to store GPG Passphrases

gpg-agent setup

Need to setup gpg-agent first, on OSX I use keychain (it also does ssh-agent)

$ brew info keychain
keychain: stable 2.8.5
User-friendly front-end to ssh-agent(1)
https://www.funtoo.org/Keychain
/usr/local/Cellar/keychain/2.8.5 (7 files, 108.5KB) *
@kushsharma
kushsharma / __dag_refresh.py
Created July 14, 2021 05:54
Airflow DAG for automatic scheduler steroids injection.
'''
DAG for automatic scheduler steroids injection.
This fixes Airflow scheduler leaving dag runs in running state although
tasks are completed successfully.
This runs every day and refresh last 7 days of dags but if you want to run
on ad-hoc basis refresh older dags, use manual trigger and pass start_range
as a date like '2021-01-01T00:00:00Z'
'''
from typing import Any, Callable, Dict, Optional
@kushsharma
kushsharma / script-template.sh
Created December 17, 2020 09:20 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]