Skip to content

Instantly share code, notes, and snippets.

View weibeld's full-sized avatar

Daniel Weibel weibeld

View GitHub Profile
@weibeld
weibeld / k8s-check-container-user.sh
Created September 8, 2022 12:28
Check user of all containers in a Kubernetes cluster
#!/bin/bash
kubectl get pods --all-namespaces -o 'custom-columns=:.metadata.namespace,:.metadata.name,:.spec.initContainers[*].name' |
while read line; do
namespace=$(awk '{print $1}' <<<"$line")
pod=$(awk '{print $2}' <<<"$line")
containers=($(awk '{print $3}' <<<"$line" | tr , ' '))
for container in "${containers[@]}"; do
echo -n "$namespace | $pod | $container: "
kubectl exec "$pod" -n "$namespace" -c "$container" -- whoami 2>/dev/null || echo "<unknown>"
@weibeld
weibeld / README.md
Last active August 5, 2022 10:23
Open Chrome bookmarks in new tab

Open Chrome bookmarks in new tab

Procedure for editing all bookmarks in Chrome so that they open in a new tab:

  1. Open Bookmark Manager
  2. Vertical dots (upper right corner) > Export bookmarks
  3. cat bookmarks_*.html | update-urls.sh >bookmarks_new.html
  4. Delete all bookmarks in Chrome
  5. Vertical dots (upper right corner) > Import bookmarks > Select bookmarks_new.html
@weibeld
weibeld / package-chart.sh
Created January 1, 2022 17:39
Package a Helm chart
# Locally package a Helm chart by using a custom values file.
usage() {
echo -e "USAGE\n $(basename $0) chart-dir [values-file] [templates-dir]"
}
[[ ! ( "$#" -eq 1 || "$#" -eq 2 || "$#" -eq 3 ) ]] && { usage; exit 1; }
chart=${1%/}
values=$2
templates=$3
@weibeld
weibeld / get-cncf-logo.sh
Last active September 16, 2020 16:55
Download the official logo pack of a CNCF project from the CNCF Branding page (https://cncf-branding.netlify.app/)
#!/usr/bin/env bash
set -e
usage() {
cat <<EOF
$(basename $0) - Download the official logo pack of a CNCF project
USAGE
$(basename $0) project [dir]
@weibeld
weibeld / 10-use-case-2.yml
Last active August 4, 2020 11:10
GitHub Actions example workflow — Use Case 2
name: upgrade
on:
repository_dispatch:
types: [upgrade-formula]
jobs:
main:
env:
FORMULA: ${{ github.event.client_payload.formula }}
URL: ${{ github.event.client_payload.url }}
SHA256: ${{ github.event.client_payload.sha256 }}
@weibeld
weibeld / 10-use-case-1.yml
Last active April 19, 2023 22:39
GitHub Actions example workflow — Use Case 1
name: release
on:
release:
types: [published]
jobs:
main:
runs-on: ubuntu-latest
env:
ARCHIVE_NAME: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}
steps:
@weibeld
weibeld / 09-outputs-4.yml
Last active August 2, 2020 12:24
GitHub Actions example workflow — Outputs 4
name: outputs-4
on: workflow_dispatch
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- name: step-1
id: xyz
run: echo "::set-output name=ip-address::$(curl -s ifconfig.me)"
- name: step-2
@weibeld
weibeld / 09-outputs-3.yml
Created August 2, 2020 11:55
GitHub Actions example workflow — Outputs 3
name: outputs-3
on: workflow_dispatch
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- name: step-1
id: xyz
uses: actions/create-release@v1
with:
@weibeld
weibeld / 09-outputs-2.yml
Created August 2, 2020 11:25
GitHub Actions example workflow — Outputs 2
name: outputs-2
on: workflow_dispatch
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- name: step-1
id: xyz
run: echo "::set-output name=ip-address::$(curl -s ifconfig.me)"
- name: step-2
@weibeld
weibeld / 09-outputs-1.yml
Last active August 17, 2020 12:38
GitHub Actions example workflow — Outputs 1
name: outputs-1
on: workflow_dispatch
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- name: step-1
id: xyz
run: echo "::set-output name=ip-address::$(curl -s ifconfig.me)"