Skip to content

Instantly share code, notes, and snippets.

View maelvls's full-sized avatar

Maël Valais maelvls

View GitHub Profile
@maelvls
maelvls / gh-gocover
Last active September 15, 2023 08:39
gh-gocover – Share the coverage.html for a given pull request on GitHub. Requires git, gocover, gsutil, and gh.
#! /bin/bash
set -euo pipefail
# Source: https://gist.github.com/maelvls/bd9b48ed236a4622e5c7794a04d73752
help() {
cat <<EOF
Usage: gh gocover --pr <number> --bucket gs://bucket/path [flags]
Description:
@maelvls
maelvls / auto-merge
Last active September 11, 2023 13:57
Auto-approve GitLab merge requests when there is a "2 approvals" requirement on a repository that slows things down and needs to be worked around.
#!/bin/bash
#
#
# Copy auto-approve to the VM:
# gcloud compute ssh cronjob-gitlab-approval --zone europe-west2-b -- sudo tee /usr/local/bin/auto-approve <~/bin/auto-approve >/dev/null
#
# Then:
# gcloud compute ssh cronjob-gitlab-approval --zone europe-west2-b
# crontab -e
#
@maelvls
maelvls / README.md
Last active November 30, 2022 14:30

Tired of having to wait for Cloudshare's progress bar to fill up? Here is a script that does it for you.

2022-11-30 15 27 23

@maelvls
maelvls / jenkins.sh
Last active January 30, 2024 18:34
Jenkins CLI for launching builds
#! /bin/bash
set -euo pipefail
help() {
cat <<EOF
USAGE
$(basename "$0") --url https://jenkins/job/foo/job/bar --user <username> --token <token> --arg param=value --arg param2=value2
DETAILS
@maelvls
maelvls / README.md
Last active June 8, 2022 14:43
Visualize the interaction between the Kubernetes apiserver and the cert-manager webhook using mimtproxy

Visualize the interaction between the Kubernetes apiserver and the cert-manager webhook using mimtproxy

This mitmproxy file was created using Kubernetes 1.21 and cert-manager 1.7.

To visualize this HTTP interaction, install mitmproxy and run:

curl -sSLO https://raw.githubusercontent.com/maelvls/kubectl-incluster/main/josejson.py
curl -sSLO https://gist.githubusercontent.com/maelvls/8a7fd6e6f1e92045813b120ad063d9ae/raw/22ece3844cb21c76d3077090d06368d5943729c9/apiserver-to-webhook.mitmproxy
@maelvls
maelvls / README.md
Last active April 16, 2023 12:30
Building ksnip

Building ksnip to work around images growing on each save

The issue in question is kImageAnnotator#257.

Updated on 16 April 2023 with ksnip 1.10.1.

git clone https://github.com/ksnip/kColorPicker
git clone https://github.com/ksnip/kImageAnnotator
git -C kImageAnnotator remote add maelvls https://github.com/maelvls/kImageAnnotator
@maelvls
maelvls / README.md
Last active February 15, 2023 12:48

The slight differences between Unix tools across BSD (incl. macOS), GNU/Linux, and Busybox

This is a list of discrepencies I came across while trying to while cross-system compatible makefiles and Bash scripts.

sed

-i (in-place editing) can work without an argument with GNU sed, but won't work without an argument on BSD sed and on Busybox.

@maelvls
maelvls / README.md
Last active April 4, 2022 12:39
Deploy a dev version of cert-manager to your GKE or OpenShift cluster

Deploy a dev version of cert-manager to your GKE or OpenShift cluster

If you would like to use the new Make flow (we dropped Bazel!), here is a tutorial on how test cert-manager on a non-kind cluster such as GKE or OpenShift. In this tutorial, I assume that you have cloned cert-manager/cert-manager and that you have a shell session open in that folder. I also assume that your GKE or OpenShift cluster has access to the Docker Hub registry (i.e., you cluster has access to the internet).

You will need docker, helm, and crane installed. If you are on macOS or on Linux, you can install helm and crane using Homebrew:

@maelvls
maelvls / README.md
Last active September 7, 2022 14:12

Dev Assistant (chrome extension) settings

This gist can be shared, no problem.

Update 6 June 2022: it seems like dev assistant, which was published as a Chrome extension, has been withdrawn (probably by their authors). The source code for the extension is on GitHub: https://github.com/shridhar-tl/dev-assist. I don't know how to add the extension "manually" using the source code.

Screenshot 2022-03-01 at 12 11 35

@maelvls
maelvls / README.md
Last active February 22, 2022 18:32
cert-manager ACME solver uses the `jwk` field instead of `kid` in neworder call for non-letsencrypt calls

Investigation: cert-manager ACME solver uses the jwk field instead of kid in neworder call for non-letsencrypt calls

In the Stackover question 70897574, user1563721 suggests that cert-manager's ACME solver is not behaving as it should with non-let's encrypt servers. More specifically, that new-order is called using kid instead of jwk. In the remainder of this page, I detail how to reproduce this issue using Pebble (a smaller version of Boulder, which is the ACME server Let's Encrypt uses).

Related:

Install cert-manager but turn off the deployment: