Skip to content

Instantly share code, notes, and snippets.

View shinhwagk's full-sized avatar

gk shinhwagk

  • Shanghai, China
View GitHub Profile
# Source: https://gist.github.com/48f44d3974db698d3127f52b6e7cd0d3
###########################################################
# Automation of Everything #
# How To Combine Argo Events, Workflows, CD, and Rollouts #
# https://youtu.be/XNXJtxkUKeY #
###########################################################
# Requirements:
# - k8s v1.19+ cluster with nginx Ingress
@jsiebens
jsiebens / fabio.nomad
Last active September 24, 2023 06:23
Nomad monitoring with Thanos
job "fabio" {
datacenters = ["dc1"]
type = "system"
group "fabio" {
network {
mode = "host"
port "lb" {
static = 9999
@epcim
epcim / kubernetes_pods_docker_disk_usage.md
Last active February 5, 2026 20:00
docker disk space introspection kubernetes docker overlay

identify big pods/containers

investigage big files

DST=/mnt
find /var/lib -type f -size +1G -exec ls -lh {} \; | tee  $DST/bigfiles_var_lib_$(date "+%H%M").log
find /var/lib -type f -size +1G -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -rh > $DST/bigfiles_var_lib_$(date "+%H%M").sorted.log

misbehave processes

@atotto
atotto / ssh.go
Last active July 22, 2025 12:06
golang ssh terminal client
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
@asrivascrealytee
asrivascrealytee / grafana.nomad.hcl
Created March 11, 2019 16:17
Grafana+loki+promtail nomad example
job "grafana" {
datacenters = ["dc1"]
type = "service"
group "grafana" {
count = 1
restart {
attempts = 10
interval = "5m"
@s3fxn
s3fxn / centos7_microk8s.sh
Last active April 14, 2024 04:40
Install microk8s on CentOS7
#!/bin/bash
sudo yum -y install epel-release
sudo yum -y install snapd
sudo systemctl enable snapd
sudo systemctl start snapd
sleep 5
sudo ln -s /var/lib/snapd/snap /snap
sudo snap install microk8s --classic
sleep 5
@juanpabloaj
juanpabloaj / logging_env.py
Last active July 8, 2025 13:42
python logging, log level with environment variable
import os
import logging
LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper()
logging.basicConfig(level=LOGLEVEL, format="%(asctime)s %(message)s")
@jarek-przygodzki
jarek-przygodzki / node_exporter-as-systemd-service.md
Last active March 10, 2026 01:09
Installing node_exporter as systemd serivice
sudo useradd --system --shell /bin/false node_exporter
curl -fsSL https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz \
  | sudo tar -zxvf - -C /usr/local/bin --strip-components=1 node_exporter-1.3.1.linux-amd64/node_exporter \
  && sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
@supix
supix / postgres_recovery.md
Last active November 4, 2025 14:44
Postgres error: Missing chunk 0 for toast value in pg_toast

The problem

In some cases, it is possible that PostgreSQL tables get corrupted. This can happen in case of hardware failures (e.g. hard disk drives with write-back cache enabled, RAID controllers with faulty/worn out battery backup, etc.), as clearly reported in this wiki page. Furthermore, it can happen in case of incorrect setup, as well.

One of the symptoms of such corruptions is the following message:

ERROR: missing chunk number 0 for toast value 123456 in pg_toast_45678

This almost surely indicates that a corrupted chunk is present within a table file. But there is a good way to get rid of it.

@saintplay
saintplay / counter.function.js
Last active April 7, 2026 13:14
Add counter for Firestore Collection
// functions/income/counter.function.js
'use strict'
const functions = require('firebase-functions')
const admin = require('firebase-admin')
// Prevent firebase from initializing twice
try { admin.initializeApp(functions.config().firebase) } catch (e) {}