Skip to content

Instantly share code, notes, and snippets.

View reegnz's full-sized avatar

Zoltán Reegn reegnz

View GitHub Profile
@reegnz
reegnz / README.md
Last active September 25, 2024 09:01
Listing all container images being used in kubernetes cluster

Listing all container images being used in kubernetes cluster

Getting all images referenced in pod specs:

kubectl get pods -A -o json  |
  jq -r '[.items[].spec | (.initContainers // empty | .[].image), .containers[].image] | unique | sort | .[]'

Getting all images cached on nodes:

@reegnz
reegnz / README.md
Last active December 17, 2021 23:11
Web search from vim

Vim web search using movements to select the search text

With the vim code below, you can perform a web search (Google in the example).

Typing v2wss will visually select 2 words and then open a google search with those 2 words. Typing ss2w will perform the same as above, but in normal mode.

@reegnz
reegnz / README.md
Last active December 17, 2021 21:52
Open JIRA issues from vim

Opening JIRA issues from vim

Did you ever want to open a JIRA issue from vim, so you copied the jira issue name, opened the browser, opened JIRA then pasted the issue id into the search, then clicked on the search result?

That sequence above is terribly tedious!

With the vim script below, you just position your cursor on top of the ticket id, then hit gj and boom! Issue is opened in your browser!

@reegnz
reegnz / README.md
Last active May 23, 2024 07:31
Inspecting Kubernetes JWT tokens

Inspecting Kubernetes JWT tokens

Start a cluster with a dummy workload

kind create cluster
kubectl apply -f cli.yaml
kubectl apply -f discovery.yaml
@reegnz
reegnz / README.md
Last active October 22, 2021 13:28
mitmproxy on MacOS with Keychain integration

mitmproxy on MacOS with Keychain integration

Root certificate generation

You need to get a root certificate in place for mitmproxy. The easy way to do that is to just run mitmproxy and exit. The certificate can then be found at ~/.mitmproxy/mitmproxy-ca.pem.

Putting the root certificate into the MacOS Keychain

@reegnz
reegnz / README.md
Last active October 18, 2021 10:56
The simplest terraform version manager script you've ever seen

The simplest terraform version manager script you've ever seen

These two scripts provide the bare-minimum version-manager capability for terraform.

Installation:

  1. Put both files somewhere on your PATH
  2. chmod +x on both files to make them executable

Usage:

@reegnz
reegnz / main.tf
Created February 10, 2021 19:04
terraform github provider data source issue
provider "github" {
# using environment variables:
# GITHUB_ORGANIZATION
# GITHUB_BASE_URL
# GITHUB_TOKEN
}
data "github_team" "team" {
slug = "test-team"
}
@reegnz
reegnz / main.tf
Created February 10, 2021 18:49
terraform github provider issue
provider "github" {
# using environment variables:
# GITHUB_ORGANIZATION
# GITHUB_BASE_URL
# GITHUB_TOKEN
}
resource "github_team" "team" {
name = "test-team"
}
@reegnz
reegnz / README.md
Last active October 22, 2024 13:55
The Terraform group_by you've been missing

The Terraform group_by you've been missing

I'm playing around a lot nowadays with Terraform 0.13 and I found a really interesting feature and that's the ... symbol (also called an ellipsis) to be used with for expressions.

The operator can be used for group_by operations.

Example

We have a list of entries. The list contains employee/manager/project triplets.

@reegnz
reegnz / README.md
Created June 19, 2020 10:39
CamelCase <--> snake_case conversion in jq

CamelCase <--> snake_case conversion with jq

tl;dr

I provide you with 3 jq lib functions that will help you in converting between snake_case and CamelCase.

The interface

I want to change keys in my json from camelcase to snake_case.