Skip to content

Instantly share code, notes, and snippets.

@Gibby
Gibby / jq-cheetsheet.md
Created January 26, 2023 17:15 — forked from Chris-Softrams/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@Gibby
Gibby / gist:9d3faf609e0d66e8b79f3ac13a64e4f3
Last active February 1, 2022 16:19
Force kubernetes namespace - Use for when namespace stuck in terminating
#!/bin/bash
NAMESPACE="foo" \
kubectl get namespace "$NAMESPACE" -o json | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/"$NAMESPACE"/finalize -f -
@Gibby
Gibby / sophos
Created February 1, 2022 13:33
Simple Script to Disable and Enable Sophos On MAC - Needs Root Access
#!/bin/bash
enable() {
sudo mv "/Library/Sophos Anti-Virus.disabled" "/Library/Sophos Anti-Virus"
sudo mv "/Library/SophosCBR.disabled" "/Library/SophosCBR"
sudo mv "/Applications/Sophos.disabled" "/Applications/Sophos"
}
disable() {
sudo mv "/Library/Sophos Anti-Virus" "/Library/Sophos Anti-Virus.disabled"
@Gibby
Gibby / bash-script-template.sh
Created May 13, 2021 17:17
Bash script template
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@Gibby
Gibby / kubectl-multi-version-brews.md
Created October 29, 2020 18:09 — forked from rdump/kubectl-multi-version-brews.md
kubectl multi-version brews (kubernetes-cli formula)

kubectl multi-version brews

We need to run multiple versions of kubectl for compatibility with various kubernetes clusters.

It's a bit easier to get and use multiple versions of kubectl using Homebrew than it is using Macports.

With brew, it's simple to:

  • Install a bunch of versions of kubectl (in the kubernetes-cli Formula)
  • Switch between them as needed
@Gibby
Gibby / install_tmux_macos_no_brew.sh
Created July 8, 2020 17:16 — forked from dxps/install_tmux_macos_no_brew.sh
Install TMUX on MacOS without Brew
#!/bin/sh
## setup _________________________________
TMUX_VER=2.9a
LIBEVENT_VER=2.1.11-stable
TEMP_COMPILE=~/tmux-temp-compile
COMMON_INSTALL_PREFIX=/opt
SYMLINK=/usr/local/bin/tmux
@Gibby
Gibby / README.md
Last active January 3, 2020 19:00
docker-compose example for offloading SSL with NGINX and Lets Encrypt certificates for services not running on docker like BlueIris

Update environment and volume sections in docker-compose.yaml

To get a valid certificate but not allow external access to the service see https://github.com/jwilder/nginx-proxy#internet-vs-local-network-access

Requirements docker-compose.yaml:

  • nginx-proxy must be publicly reachable on both port 80 and 443.
  • Check your firewall rules/port forwards and do not attempt to block port 80 as that will prevent http-01 challenges from completing.
  • For the same reason, you can't use nginx-proxy's HTTPS_METHOD=nohttp.
  • The (sub)domains you want to issue certificates for must correctly resolve to the host.
  • Your DNS provider must answer correctly to CAA record requests.

Keybase proof

I hereby claim:

  • I am gibby on github.
  • I am cgibson13 (https://keybase.io/cgibson13) on keybase.
  • I have a public key ASAtPHCZo-xqjpRA0kW8EMJbQ2Kanh-WDd5MWuV9Bmci5Ao

To claim this, I am signing this object: