Skip to content

Instantly share code, notes, and snippets.

View chmouel's full-sized avatar
🤨
Kuberneting

Chmouel Boudjnah chmouel

🤨
Kuberneting
View GitHub Profile
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
apiServerAddress: "10.0.111.66"
apiServerPort: 8443
kubeadmConfigPatchesJSON6902:
- group: kubeadm.k8s.io
version: v1beta2
kind: ClusterConfiguration
patch: |
@chmouel
chmouel / gnus-demon-config.el
Last active February 11, 2021 21:56
Integrate GNUS with Argos
(defun gnus-demon-scan-mail-or-news-and-update (level)
"Scan for new mail, updating the *Group* buffer."
(let ((win (current-window-configuration)))
(unwind-protect
(save-window-excursion
(save-excursion
(when (gnus-alive-p)
(save-excursion
(set-buffer gnus-group-buffer)
(gnus-group-get-new-news level)))))
status title creation-date last-updated authors
proposed
Pipeline as a Code
2020-11-24
2020-11-24
chmouel
afrittoli

TEP-0037: Pipeline as a Code

# -*- coding: utf-8 -*-
# Author: Chmouel Boudjnah <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: tkn-cleanup
spec:
failedJobsHistoryLimit: 1
successfulJobsHistoryLimit: 1
concurrencyPolicy: Replace
schedule: "0 0 * * *"
@chmouel
chmouel / yamllint-pre-commit.bash
Last active October 14, 2020 10:48
yamllint yaml files on GIT pre-commit hook script
#!/usr/bin/env bash
# To be copied in .git/hooks/pre-commit (0755 mode)
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
@chmouel
chmouel / github-upload-file-via-blob-tree.py
Last active October 10, 2020 20:33
Upload to GitHUB with a blob/tree/commit python
import whatsneeded
GITHUB_TOKEN = "WHATEVERWILLBEWILLBE"
def github_request(method, url, headers=None, data=None, params=None):
"""Execute a request to the GitHUB API, handling redirect"""
if not headers:
headers = {}
headers.update({
"User-Agent": "Agent 007",
def github_upload_file(
repository: str,
filename: str,
dest: str,
commiter_name: str,
commiter_email: str,
commit_message: str,
):
url = f"https://api.github.com/repos/{repository}/contents/{dest}"
base64content = base64.b64encode(open(filename, "rb").read())
#!/usr/bin/env bash
set -eu
fname=${1:-template.yaml}
TMP=$(mktemp /tmp/.mm.XXXXXX)
clean() { rm -f ${TMP}; }
trap clean EXIT
cat ${fname} > ${TMP}