Skip to content

Instantly share code, notes, and snippets.

@akhenakh
akhenakh / app.yaml
Last active March 4, 2023 19:22
Example of graceful shutdown with grpc healthserver * httpserver
readinessProbe:
exec:
command: ["/root/grpc_health_probe", "-addr=:6666"]
initialDelaySeconds: 1
livenessProbe:
exec:
command: ["/root/grpc_health_probe", "-addr=:6666"]
initialDelaySeconds: 2
imagePullPolicy: IfNotPresent
@jschaf
jschaf / scratch_server.go
Created March 12, 2019 07:40
A Go web server from scratch using syscalls
package main
// Simple, single-threaded server using system calls instead of the net library.
//
// Omitted features from the go net package:
//
// - TLS
// - Most error checking
// - Only supports bodies that close, no persistent or chunked connections
// - Redirects
@veggiemonk
veggiemonk / CKAD.md
Last active March 20, 2026 08:21
CKAD exam preparation
@NiklasMerz
NiklasMerz / deployment.yaml
Last active May 9, 2020 00:07
Github Actions Kubernetes Deploy
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: myproject
name: myproject
namespace: default
spec:
progressDeadlineSeconds: 600
replicas: 1
package events
import (
"encoding/json"
"io"
"net/http"
"github.com/joomcode/errorx"
"github.com/nats-io/go-nats-streaming"
uuid "github.com/satori/go.uuid"
@milesbxf
milesbxf / monzo-alertmanager-config.yaml
Last active May 19, 2026 13:19
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active July 20, 2026 22:09
set -e, -u, -o, -x pipefail explanation
@simonswine
simonswine / restic-exporter.sh
Created September 10, 2018 08:40
Write restic metrics for repo filesystem for node_exporters file collector
#!/bin/sh
set +e
set +x
NAMESPACE=restic
BACKUP_FOLDER=/opt/backup/restic
for dir in $(find "${BACKUP_FOLDER}" -type d -maxdepth 1 -mindepth 1); do
@rcrowe
rcrowe / run.sh
Created August 29, 2018 10:43
Dump a copy of all databases in CockroachDB
#!/bin/bash
set -e
# ---------
# Variables
# ---------
dbHost=$COCKROACH_HOST
if [[ -z $dbHost ]]; then
@mbove77
mbove77 / optimizeAndCropImage.cloudFunction.js
Created August 21, 2018 18:21
Firebase cloud function to resize and optimize image after upload in cloud storage.
const functions = require('firebase-functions');
const gcs = require('@google-cloud/storage')();
const spawn = require('child-process-promise').spawn;
const mkdirp = require('mkdirp-promise');
const path = require('path');
const os = require('os');
const fs = require('fs');
// // Create and Deploy Your First Cloud Functions
exports.optimizeImages= functions.storage.object().onFinalize((data) => {