Skip to content

Instantly share code, notes, and snippets.

View maxbrunet's full-sized avatar
💭
I may be slow to respond.

Maxime Brunet maxbrunet

💭
I may be slow to respond.
View GitHub Profile
@maxbrunet
maxbrunet / README.md
Last active February 12, 2022 01:08
Programmatically add a Grafana datasource template to a dashboard (jq / Jsonnet)

Templatize Grafana Dashboard Datasource

Easily add a $DS_PROMETHEUS datasource variable with its templating to a Grafana dashboard with jq or Jsonnet.

jq

./templatize_dashboard_datasource.jq dasboard.json >dashboard-new.json
@maxbrunet
maxbrunet / README.md
Last active February 17, 2023 20:02
Argo CD Application Controller Custom Sharding

Argo CD Application Controller Custom Sharding

This short Go program uses a Fist-fit-decreasing Bin Packing algorithm to assign Kubernetes clusters to different Argo CD Application Controller shard based on their resources count. It bases its calculations on the output of the argocd-util cluster stats command. The output can be used to update the undocumented shard key of the cluster secrets.

Example usage

argocd-util cluster stats --namespace=argocd | go run reshard.go
@maxbrunet
maxbrunet / virtualenvwrapper2pyenv.sh
Created April 12, 2019 20:45
Script to migrate from virtualenvwrapper to pyenv-virtualenv
#!/bin/sh
set -eu
PYTHON_EXE='python3'
VIRTUALENVWRAPPER='virtualenvwrapper.sh'
echo '>>> Sourcing virtualenvwrapper...'
. "${VIRTUALENVWRAPPER}"
echo '>>> Starting migration from virtualenvwrapper to pyenv-virtualenv...'
@maxbrunet
maxbrunet / find_missing_deps.py
Created August 11, 2018 21:34
Find missing dependencies for Ansible plugins. Related to Homebrew/homebrew-core#28839
#!/usr/bin/env python
from distutils.sysconfig import get_python_lib
from glob import iglob
from modulefinder import ModuleFinder
EXCLUDED_DEPENDENCIES = [
# Standard libraries
'distutils',
'func',