Skip to content

Instantly share code, notes, and snippets.

@negz
negz / kubedump.sh
Last active July 11, 2024 10:57
Dump Kubernetes cluster resources as YAML
#!/usr/bin/env bash
set -e
CONTEXT="$1"
if [[ -z ${CONTEXT} ]]; then
echo "Usage: $0 KUBE-CONTEXT"
exit 1
fi
@negz
negz / audit.py
Created February 15, 2017 17:21
Log audit script
import json
json_lines = [json.loads(line) for line in open("sumo.json", "r").readlines()]
for line in json_lines:
host = line.get("host")
if host is None:
print "Line missing host key"
if host == "":
print "Line has empty host key"
@negz
negz / play.go
Created October 13, 2016 00:04
SRV resolution test
func main() {
log := zap.New(zap.NewTextEncoder(), zap.AddCaller(), zap.DebugLevel)
lib := dns.NewLookupLib("127.0.0.1:53")
srv := "_talos._https.example.org"
b := lb.New(&lb.Config{Dns: lib, Strategy: random.RandomStrategy}, srv)
for {
time.Sleep(time.Second)
a, err := b.Next()
@negz
negz / vol.py
Created October 12, 2016 04:01
secret-volume creation snippet
#!/usr/bin/env python
import logging
import sys
import requests
def main():
logging.basicConfig(level=logging.DEBUG)
@negz
negz / HeliosSoloTesting.java
Last active December 7, 2015 19:26
Potential helios solo / testing usage.
package com.spotify.wiggum;
import com.google.common.net.HostAndPort;
import com.spotify.helios.testing.TemporaryJob;
import com.spotify.helios.testing.TemporaryJobs;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;