Skip to content

Instantly share code, notes, and snippets.

View clementnuss's full-sized avatar
🐄

Clément Nussbaumer clementnuss

🐄
View GitHub Profile
@dymk
dymk / avahi-suffix-remover.py
Created December 31, 2022 19:01
Watch for avahi state changes, and remove the `-2` suffix from the hostname
import dbus, avahi
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
import time
class Runner():
def __init__(self, avahi_server):
self.avahi_server = avahi_server
def on_state_change(self, state, error):
@HosseyNJF
HosseyNJF / README.md
Last active March 24, 2025 17:48
Delete data from exported time-series from Prometheus / VictoriaMetrics in a time range.

Usage

Note that the response cache must be deleted after these steps in order to remove previously cached results - see more details here.

@rishitells
rishitells / Jest_GitLab_CI.md
Last active December 25, 2024 22:21
Setting up Jest tests and coverage in GitLab CI

Configuring Jest Tests in GitLab CI

1. Add GitLab CI configuration file in the root

In the root of your project, add .gitlab-ci.yml with the configuration below.

image: node:latest

stages:
@f41gh7
f41gh7 / api-server.yaml
Last active August 21, 2023 10:31
vm operator configuration examples
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
name: apiserver
namespace: monitoring-system
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
bearerTokenSecret:
key: ""
@superseb
superseb / k3s-etcd-commands.md
Last active March 17, 2025 06:33
k3s etcd commands

k3s etcd commands

etcd

Setup etcdctl using the instructions at https://github.com/etcd-io/etcd/releases/tag/v3.4.13 (changed path to /usr/local/bin):

Note: if you want to match th etcdctl binaries with the embedded k3s etcd version, please run the curl command for getting the version first and adjust ETCD_VER below accordingly:

curl -L --cacert /var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --cert /var/lib/rancher/k3s/server/tls/etcd/server-client.crt --key /var/lib/rancher/k3s/server/tls/etcd/server-client.key https://127.0.0.1:2379/version
@gmolveau
gmolveau / golang_offline.md
Last active May 29, 2024 19:23
golang mod offline dependencies download

golang offline module dependencies download

Using go mod vendor

0 - With an existing module

  • copy go.mod and go.sum files from the offline PC to the internet PC

0bis - New module

@max-rocket-internet
max-rocket-internet / prom-k8s-request-limits.md
Last active March 30, 2025 02:08
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
@abdennour
abdennour / README.md
Last active March 3, 2025 23:46
Nginx Reverse Proxy for Nexus Docker Registries

Overview

This is a solution of a common problem with Nexus Docker repositories. The administrator has to expose port for "pull", another port for "push", other ports for each hosted repository. This solution is about leveraging Nginx reverse proxy to avoid using these ports.

How it works ?

Given :

  • Nexus hostname is "nexus.example.com"
  • Nexus web port is 8081
@john-auld
john-auld / ssh-agent-windows10.md
Created June 7, 2019 11:10
SSH Agent for Visual Studio Code on Windows 10

Using ssh-agent with Visual Studio Code on Windows 10

Enable the ssh-agent service

To enable SSH Agent automatically on Windows, start PowerShell as an Administrator and run the following commands:

# Make sure you're running as an Administrator
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
@ww9
ww9 / gist_blog.md
Last active March 31, 2025 07:33
Using Gist as a blog #blog

Blogging with Gist

Gist simplicity can turn blogging into a liberating experience.

Pros Cons
✅ Free, simple, fast, hassle-free ❌ Image upload in comments only
✅ Tagging ❌ No post pinning
✅ Search ❌ Doesn't look like a blog
✅ Revisions ❌ Unfriendly URLs