Skip to content

Instantly share code, notes, and snippets.

@shcallaway
shcallaway / README.md
Last active August 15, 2024 10:28
Use jq to parse JSON logs into something more readable

Structured logs are way better than normal logs for a whole bunch of reasons, but they can sometimes be a pain to read in the shell. Take this logline for example:

{"erlang_pid":"#PID<0.1584.0>","level":"error","message":"Got error when retry: :econnrefused, will retry after 1535ms. Have retried 2 times, :infinity times left.","module":"","release":"c2ef629cb357c136f529abec997426d6d58de485","timestamp":"2019-12-17T19:22:11.164Z"}

This format is hard for a human to parse. How about this format instead?

error | 2019-12-17T19:21:02.944Z | Got error when retry: :econnrefused, will retry after 1648ms. Have retried 2 times, :infinity times left.
@magicdude4eva
magicdude4eva / zsh-syntax-highlighting paste performance improvement
Last active March 20, 2025 19:02
zsh-syntax-highlighting paste performance improvement
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
@zikes
zikes / .zshrc
Last active November 14, 2022 03:45
Using kube-ps1 with P9K
# Enable the kube-ps1 oh-my-zsh plugin
plugins = (
git
kube-ps1
)
# The output of the kube_ps1 function is text, so it can be used
# directly as a custom p9k segment
POWERLEVEL9K_CUSTOM_KUBE_PS1='kube_ps1'
@falcon78921
falcon78921 / ceph_bench.sh
Created June 27, 2018 19:49
Benchmark Ceph using rados bench
#!/bin/bash
# Benchmarking Ceph
# falcon78921
# RBD Variables
rbdPool=$1
rbdWriteInterval=$2
rbdReadInterval=$3
@lanbugs
lanbugs / paloalto_xmlapi.py
Created June 22, 2018 22:16
Palo Alto Networks XML API with python and beautifulsoup, example prints ARP table
#!/usr/bin/env python
# required pip packages: lxml, beautifulsoup4, tabulate
from bs4 import BeautifulSoup as BS
import urllib2
import ssl
import urllib
from tabulate import tabulate
@edsiper
edsiper / kubernetes_commands.md
Last active April 8, 2025 09:02
Kubernetes Useful Commands
@mgoodness
mgoodness / k8s-svc-annotations.md
Last active September 7, 2024 16:25
AWS ELB-related annotations for Kubernetes Services (as of v1.12.0)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags (comma-separated list of key=value)
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)
@mgoodness
mgoodness / asp.sh
Last active October 14, 2021 08:36
Bash/Zsh function for switching AWS profiles (supports sts assume-role)
function asp {
if [[ -z "$1" ]]; then
if [[ -z "$AWS_DEFAULT_PROFILE" ]]; then
echo "No profile set"
else
asp "$AWS_DEFAULT_PROFILE"
echo "$AWS_DEFAULT_PROFILE"
fi
else
if ! fgrep -q "[profile $1]" ~/.aws/config; then
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

bootcfg ACI Experiment

Note: Real bootcfg release ACIs are uploaded to coreos/coreos-baremetal. This is just an experiment.

Build and Sign

Build the binary and ACI. Change the build-aci script to use app name aci.dghubble.io/bootcfg before running.