Skip to content

Instantly share code, notes, and snippets.

View VanceLongwill's full-sized avatar
🏠
Working from home

Vance Longwill VanceLongwill

🏠
Working from home
  • Edinburgh, United Kingdom
View GitHub Profile
@VanceLongwill
VanceLongwill / rename_deployments.sh
Last active January 27, 2023 08:24
Rename kubernetes deployments
#!/bin/bash
set -e
usage() {
cat <<EOF
$0 - Rename k8s deployments
usage:
#!/bin/bash
set -e
usage() {
echo ""
echo "$0 <topic-name>"
echo ""
echo "Create a temporary pubsub subscription and tail messages on the given topic."
echo "Messages will be pulled until an interrupt signal is received. Press Ctrl+C to exit."
@VanceLongwill
VanceLongwill / label_replace.sh
Created October 14, 2022 13:35
Simple bash script to expand promql labels
#!/bin/bash
usage() {
cat <<EOF
Label replace expands the 'information' field in promql. It accepts your unexpanded promql query from stdin.
usage:
$0 <label-name> <default-value>
@VanceLongwill
VanceLongwill / label_replace.sh
Created October 14, 2022 13:33
Simple bash script to expand promql labels
#!/bin/bash
usage() {
cat <<EOF
Label replace expands the 'information' field in promql. It accepts your unexpanded promql query from stdin.
usage:
$0 <label-name> <default-value>
set-option -g mouse on
set-option -g default-terminal "screen-256color"
set-option -sa terminal-overrides ',XXX:RGB'
set -ga terminal-overrides ",*256col*:Tc"
set -g mouse on
setw -g mode-keys vi
# If you don’t mind artifically introducing a few Vim-only features to the vi mode, you can set things up so that v starts a selection and y finishes it in the same way that Space and Enter do, more like Vim:
@VanceLongwill
VanceLongwill / prometheus_patch.sh
Last active August 9, 2022 10:06
Patch prometheus annotations into deployments
#!/bin/zsh
PROM_PATCH=$(cat <<EOF
spec:
template:
metadata:
annotations:
prometheus.io/port: "2112"
prometheus.io/scrape: "true"
EOF
@VanceLongwill
VanceLongwill / test_times.sh
Created August 8, 2022 08:24
A bash function helper that runs go tests until one fails or the given iteration limit is reached
test_times() {
if [[ -z $1 ]]; then
echo "USAGE: $0 <number_of_iterations> [<test_path>]\n"
echo "Description: runs go tests until one fails or the iteration limit is reached\n"
echo "Examples:\n"
echo "\t $0 100 ./pkg/messaging/... # run all the tests under ./pkg/messaging 100 times\n"
echo "\t $0 10 # run all the tests under the current working directory 10 times\n"
return 1
fi

Keybase proof

I hereby claim:

  • I am vancelongwill on github.
  • I am vancelongwill (https://keybase.io/vancelongwill) on keybase.
  • I have a public key ASAB8M8IcA9SxB6BjenYKORcGbnMZs72zVYjcH6TbZ08NAo

To claim this, I am signing this object: