Skip to content

Instantly share code, notes, and snippets.

View trietsch's full-sized avatar
💻

Robin Trietsch trietsch

💻
View GitHub Profile
// ==UserScript==
// @name Environment Banner
// @version 1.0.0
// @description Inject a small box at the top of a Grafana page to display the environment based on the URL
// @author You
// @include /^.*\.weu\.grafana\.azure\.com\/.*$/
// @grant none
// ==/UserScript==
(function () {
@trietsch
trietsch / disable-copy-shortkey-azure-devops.user.js
Created October 6, 2025 13:37
Prevent Azure DevOps from hijacking normal copy behavior in Azure DevOps
// ==UserScript==
// @name Disable copy shortkey DevOps
// @version 1.0.0
// @description DevOps does not allow using cmd+C to copy, this fixes that
// @author Robin Trietsch
// @match https://dev.azure.com/*
// @run-at document-idle
// ==/UserScript==
window.addEventListener('keydown', e => {
@trietsch
trietsch / az-pim-activate
Last active August 22, 2025 14:21
Privileged Identity Management role assignment
#!/usr/bin/env bash
# Check if exactly one argument is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <Azure Subscription Name>"
exit 1
fi
subscription_name="$1"
@trietsch
trietsch / absolute-date-gitlab-ci.user.js
Created January 8, 2025 12:43
Show absolute date in GitLab CI
// ==UserScript==
// @name Show absolute date in GitLab CI
// @version 1.0.0
// @description Automatically enables show dependencies in Gitlab CI pipelines
// @author Robin Trietsch
// @match https://gitlab.com/*/-/pipelines/*
// @match https://gitlab.com/*/-/jobs/*
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
// ==/UserScript==
@trietsch
trietsch / cli-telemetry.md
Created January 9, 2024 16:03
CLI Telemetry Collection System Blog Post

How can CLI usage be measured, while respecting end-user's privacy?

The CLI is a critical part of the developer experience. Often, it's the first interface for developers to interact with your product. However, with Open Source products, it's difficult to know if and how end-users are using your product. Even though telemetry data might be very interesting for the product team, it's important to respect the end-user's privacy; we need to ensure that no sensitive data is collected.

Only collect data on how end-users use the CLI to interact with your product, and stay inside those boundaries.

@trietsch
trietsch / git-remove-remote-merged.sh
Last active August 14, 2024 11:12
Remove local branches that have been merged in the remote (with confirmation)
#!/usr/bin/env bash
# Protip! You can add this to your gitconfig as a custom git command:
# 1. open `~/.gitconfig`
# 2. if the [alias] block doesn't exist, create it
# 3. add the following line:
# remove-remote-merged = !git-remove-remote-merged
# 4. Save the file, now you can do:
# git remove-remote-merged
// ==UserScript==
// @name Auto Enable Show Dependencies
// @version 1.0.2
// @description Automatically enables show dependencies in Gitlab CI pipelines
// @author Robin Trietsch
// @match https://gitlab*/*/-/pipelines/*
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
// @updateURL https://gist.github.com/trietsch/9c8701445a3ab5b2033ac2f615b2d2c1/raw/3b69af9ab266e0af438459337409387ec567d6db/auto-redirect.user.js
// @downloadURL https://gist.github.com/trietsch/9c8701445a3ab5b2033ac2f615b2d2c1/raw/3b69af9ab266e0af438459337409387ec567d6db/auto-redirect.user.js
@trietsch
trietsch / auto-edit-commit-message.user.js
Last active December 14, 2022 15:55
Automatically enable the edit commit message checkbox on GitLab MRs
// ==UserScript==
// @name Auto Edit Commit Message
// @version 1.0.1
// @description Automatically enables the 'edit commit message' box
// @author Robin Trietsch
// @match https://gitlab.com/*/merge_requests/*
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
// @updateURL https://gist.github.com/trietsch/9c8701445a3ab5b2033ac2f615b2d2c1/raw/d36b94d822b1b2cb7a669dc29da58af0b226ea0e/auto-edit-commit-message.user.js
// @downloadURL https://gist.github.com/trietsch/9c8701445a3ab5b2033ac2f615b2d2c1/raw/d36b94d822b1b2cb7a669dc29da58af0b226ea0e/auto-edit-commit-message.user.js
@trietsch
trietsch / auto-redirect.user.js
Last active July 26, 2022 11:35
Automatically skip the redirect notice from Google
// ==UserScript==
// @name Skip redirect notice
// @version 1.0.0
// @description Immediately redirects when presented a redirect notice from Google.
// @author Robin Trietsch
// @include https://www.google.com/url?*
// @grant none
// @updateURL https://gist.github.com/trietsch/1665db6cc6bcc5a290ef6370ca503d73/raw/3b69af9ab266e0af438459337409387ec567d6db/auto-redirect.user.js
// @downloadURL https://gist.github.com/trietsch/1665db6cc6bcc5a290ef6370ca503d73/raw/3b69af9ab266e0af438459337409387ec567d6db/auto-redirect.user.js
// ==/UserScript==
@trietsch
trietsch / gitlab_group_cluster.tf
Last active December 11, 2022 01:04
Gitlab (Group) Kubernetes Cluster with minimal RBAC (NO cluster-admin!)
/*
Gitlab offers the option to configure Kubernetes clusters (either on group level or project level) to be able to view pods
logs, and more all from the web UI. However, they advise to configure cluster-admin as a Cluster Role for the Serviceaccount
that you use to set up access from Gitlab to your cluster.
IMO, these permissions are too wide, as I'm not using Gitlab to manage deployments, that is done through Terraform in my case.
This should have been documented somewhere in the Gitlab documentation, especially since Gitlab acknowledges that many users
find the permissions too wide: https://about.gitlab.com/blog/2021/02/22/gitlab-kubernetes-agent-on-gitlab-com/
The Terraform code below includes all RBAC permissions required to view your clusters in Gitlab, as well as view the
deployment, including the number of pods. Furthermore, it allows for log viewing in Gitlab as well. Permissions are mainly