Skip to content

Instantly share code, notes, and snippets.

View chmouel's full-sized avatar
☸️

Chmouel Boudjnah chmouel

☸️
View GitHub Profile
@chmouel
chmouel / README.md
Last active November 1, 2023 18:37
hide-password-multi-writer.go

This will hide passwords implemented as a writer.

the example in main will create two writer one to stdout and one to a file, and hide a list of passwords

It tries to be a bit smart to print the characters as soon as possible

% cat test.txt
hello this is a password that string should be hidden now!!
I hope the string anotherpassword2 will be kept secret
@chmouel
chmouel / magit-log-trace-definition-ts.el
Created October 22, 2023 19:58
Magit log trace definition using TS for function name
(defun my-magit-log-trace-definition-ts()
(interactive)
(let ((funcname
(substring-no-properties
(treesit-node-text
(treesit-node-child-by-field-name (treesit-defun-at-point) "name")))))
(magit-log-trace-definition (or (magit-file-relative-name)
(user-error "Buffer isn't visiting a file"))
(or funcname
(user-error "No function at point found"))
@chmouel
chmouel / drop-git-commit.bash
Created October 10, 2023 05:58
Drop a git commit from a branch in a middle non interactive
#!/usr/bin/env bash
# Copyright 2023 Chmouel Boudjnah <chmouel@chmouel.com>
set -eufo pipefail
commit=$(git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
env FZF_DEFAULT_OPTS="--bind=ctrl-d:preview-half-page-down,ctrl-u:preview-half-page-up,ctrl-j:preview-down,ctrl-k:preview-up" \
fzf --ansi -m --no-sort --reverse --tiebreak=index)
sha=$(echo "${commit}" | grep -o '[a-f0-9]\{7\}' | head -1)
[[ -z ${sha} ]] && exit 1
#!/usr/bin/env bash
TMP=$(mktemp /tmp/.mm.XXXXXX)
clean() { rm -f $TMP; }
trap clean EXIT
query=
[[ -n $@ ]] && query="--query=$@"
case "$(uname -a)" in
*Darwin*) UEBERZUG_TMP_DIR="$TMPDIR" ;;
package main
import (
"fmt"
"log"
"regexp"
)
type Option interface {
Validate(opt any) error
---
apiVersion: v1
kind: Secret
metadata:
annotations:
pipelinesascode.tekton.dev/sha: 0aa87a87791bca86efc57676fbc5453948ae668d
pipelinesascode.tekton.dev/url: https://github.com/pdaverh/nodejs-rhtap-sandbox
pipelinesascode.tekton.dev/url-org: pdaverh
pipelinesascode.tekton.dev/url-repository: nodejs-rhtap-sandbox
creationTimestamp: null
#!/usr/bin/env bash
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
TMP=$(mktemp /tmp/.mm.XXXXXX)
clean() { rm -f ${TMP}; }
trap clean EXIT
lvim.autocommands = {
{
"BufWinEnter", {
pattern = { "*.c", "*.h", "*.mk" },
callback = function()
if string.match(vim.loop.cwd(), ".*qmk/keyboards/.*") ~= "" then
vim.api.nvim_set_keymap("n", "<leader>x", "<cmd>TermExec cmd=\"../../go.sh flash %:p:h:t\"<cr>",
{ noremap = true, silent = true })
if vim.fn.expand('%:p:h:t') == "moonlander" then
require('qmk').setup({
(defvar my-vterm-command nil)
(defun my-vterm-execute-region-or-current-line (&optional arg)
"Execute a command in vterm, pass variable or ask for it"
(interactive "p")
(require 'vterm)
(eval-when-compile (require 'subr-x))
(let ((command (or arg (read-string "Enter a command: "))))
(let ((buf (current-buffer)))
(unless (get-buffer vterm-buffer-name)
(vterm))
diff --git a/.ko.yaml b/.ko.yaml
index 4afab0e5..a4c14718 100644
--- a/.ko.yaml
+++ b/.ko.yaml
@@ -1 +1,20 @@
-defaultBaseImage: gcr.io/distroless/base-debian11:nonroot
+defaultBaseImage: quay.io/chmouel/ubi9-nonroot
+
+builds:
+- id: controller