Skip to content

Instantly share code, notes, and snippets.

View maelvls's full-sized avatar

Maël Valais maelvls

View GitHub Profile
@maelvls
maelvls / whatdidido
Last active June 14, 2021 08:13
whatdidido, the CLI for finding out what I was doing on a given day across all my git repos. I often use this to help me fill my Clockify entries (https://maelvls.dev/clockidup/)
#! /bin/bash
help() {
cat <<EOF
I often need to remember what I was doing on a certain day. So I built
this tool to help me find that out. Note that it requires GNU date.
To configure which repositories are looked into, edit the EOF block at
the end of the source of this tool.
@maelvls
maelvls / give-me-my-cluster
Last active June 1, 2024 05:11
Setup a local k3s cluster with cert-manager and Let's Encrypt with DNS01 and HTTP01 working. 🚧 REQUIRES INLETS PRO. 🚧
#! /bin/bash
set -euo pipefail
CM_VERSION=v1.3.0
CLUSTER=
PROJECT=
DNS_ZONE=
INLETS_TEXT=
@maelvls
maelvls / prokeys.json
Created April 28, 2021 07:01
I use the ProKeys extension on Chrome for snippets, like <details>
[
"Snippets",
1615367745215,
{
"name": "/none",
"body": "/release-note-none",
"timestamp": 1618436050723
},
{
"name": "close",
@maelvls
maelvls / README.md
Last active February 10, 2025 18:55
My hundred struggles while using Linux as my desktop driver (Ubuntu 22.04)

My hundred struggles while using Linux as my desktop driver (Ubuntu 24.04)

Hi! On Thursday 25 April 2021, I entirely switched from macOS to Linux: https://maelvls.dev/evolution-of-my-home-office/. I took note of every adjustment I had to make along the way. I use Ubuntu "vanilla" (with Gnome as my desktop manager).

🔥 Update 26 June 2023: I am abandoning "desktop" Linux! I can't bear having to work around everything all the time, not even counting the tons of problems that occur whenever I do a major version upgrade (e.g., when I upgraded from 21.10 to 22.04, my PPAs broken obviously, and also I lost all the hack I had made to the /etc to work around problems). I am officially back to macOS starting 26 June 2023. I'll still use my Linux workstation remotely over Mosh, but not as a desktop environment. To learn more: https://hackmd.io/@maelvls/my-macos-tweaks


My other articles:

@maelvls
maelvls / README.md
Last active July 9, 2022 13:25
Stuff about Synology OS. Moved to https://hackmd.io/8bZlqm9sQh6b0HH7Jr2YzA
@maelvls
maelvls / README.md
Last active July 24, 2024 09:05
Tips gitlab

To remove the vendor/ diffs in Go, add a bookmark in Firefox with:

javascript:(function(){ var q = prompt("Example filter: vendor/"); if (q != null) { $(".diff-file:contains(" + q + ")").detach() }}())

To expand all the resolved comments in a GitHub pull request, I used to use a bookmark with a javascript snippet using this Gist, but it seems like GitHub silently added a feature where pressing Option while clicking on "Expand comment" on one of the folded comments expands all the comments at once.

@maelvls
maelvls / watch-stream.py
Last active November 10, 2023 13:30
A mitmproxy script that makes sure the GET requests with ?watch=true (Kubernetes clients) are properly streamed
"""
Enable the streaming mode [1] whenever a request contains the query
parameter ?watch=true. The watch=true parameter is passed by Kubernertes
clients (such as client-go) when they intend to be notified of object
updates.
Use with:
mitmproxy -p 9090 -s watch-stream.py
@maelvls
maelvls / README.md
Last active April 22, 2025 08:50
Ubuntu, libsecret, git-credential-helper

Dealing with secrets

GNOME comes with libsecret. You can use libsecret to store your git credentials:

sudo apt install libsecret-1-0 libsecret-1-dev libglib2.0-dev
sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
@maelvls
maelvls / README.md
Last active November 30, 2020 15:27
Debugging Github Actions timeout issue using Deno (Nodejs replacement)

I had a bug with golangci-lint that would time out on some Github Actions builds. In order to investigate the issue, I wrote this Deno script that would scrap all the logs and look for the memory used (we used golangci-lint with the -v flag which prints how much memory was being spent).

If you also use golangci-lint and have weird time out issues, turn on golangci-lint's -v mode and run this script.

brew install deno

Run it:

kubectl run tcpd -it --rm --image=a --overrides='{"spec": {"hostNetwork": true, "containers": [{"name": "tcpd", "image": "corfr/tcpdump", "tty": true, "stdin": true, "stdinOnce": true, "securityContext": {"capabilities": {"add": ["NET_ADMIN"]}}, "args": ["-i", "any", "-U", "-w", "-"]}]}}'

Don't forget that only the DNS names with .local are forwarded by the sshuttle VPN. If you want e.g. example.com to be also forwarded to the cluster, you need to add --also-proxy example.com.

Example:

telepresence --namespace cert-manager --swap-deployment cert-manager --mount=false --run-shell --also-proxy 'example.com'