Skip to content

Instantly share code, notes, and snippets.

View maelvls's full-sized avatar

Maël Valais maelvls

View GitHub Profile
@maelvls
maelvls / README.md
Last active April 29, 2024 05:49
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 April 3, 2024 17:00
My hundred struggles while using Linux as my desktop driver (Ubuntu 22.04)

My hundred struggles while using Linux as my desktop driver (Ubuntu 22.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: 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 smoothen the transition, I use the following hacks on macOS:

  1. Linear Mouse since I can't stand macOS' mouse acceleration and also to fix my mouse wheel's direction.
  2. Magnet to be able to move wi
@maelvls
maelvls / jenkins.sh
Last active January 30, 2024 18:34
Jenkins CLI for launching builds
#! /bin/bash
set -euo pipefail
help() {
cat <<EOF
USAGE
$(basename "$0") --url https://jenkins/job/foo/job/bar --user <username> --token <token> --arg param=value --arg param2=value2
DETAILS
@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 / How-to-automate-build-bottles-your-homebrew-tap.md
Last active October 31, 2023 03:33
Automate build workflow for Homebrew tap bottles (Linux and macOS)

How to automate the build of bottles on your Homebrew tap

Note on Oct 4, 2018: due to a change in Homebrew's brew test-bot behaviour, the user must set HOMEBREW_TRAVIS_CI and HOMEBREW_TRAVIS_SUDO appropriately (it was previously using Travis-CI-provided TRAVIS and TRAVIS_SUDO).

This tutorial is a follow-up to the discussion we had on davidchall/homebrew-hep#114. It relies on a fork of the test-bot provided by davidchall; you can get it with brew tap maelvalais/test-bot. First:

  1. the Github project must be of the form https://github.com//homebrew- with the following tree
@maelvls
maelvls / gh-gocover
Last active September 15, 2023 08:39
gh-gocover – Share the coverage.html for a given pull request on GitHub. Requires git, gocover, gsutil, and gh.
#! /bin/bash
set -euo pipefail
# Source: https://gist.github.com/maelvls/bd9b48ed236a4622e5c7794a04d73752
help() {
cat <<EOF
Usage: gh gocover --pr <number> --bucket gs://bucket/path [flags]
Description:
@maelvls
maelvls / auto-merge
Last active September 11, 2023 13:57
Auto-approve GitLab merge requests when there is a "2 approvals" requirement on a repository that slows things down and needs to be worked around.
#!/bin/bash
#
#
# Copy auto-approve to the VM:
# gcloud compute ssh cronjob-gitlab-approval --zone europe-west2-b -- sudo tee /usr/local/bin/auto-approve <~/bin/auto-approve >/dev/null
#
# Then:
# gcloud compute ssh cronjob-gitlab-approval --zone europe-west2-b
# crontab -e
#
@maelvls
maelvls / README.md
Last active April 16, 2023 12:30
Building ksnip

Building ksnip to work around images growing on each save

The issue in question is kImageAnnotator#257.

Updated on 16 April 2023 with ksnip 1.10.1.

git clone https://github.com/ksnip/kColorPicker
git clone https://github.com/ksnip/kImageAnnotator
git -C kImageAnnotator remote add maelvls https://github.com/maelvls/kImageAnnotator
@maelvls
maelvls / README.md
Last active February 15, 2023 12:48

The slight differences between Unix tools across BSD (incl. macOS), GNU/Linux, and Busybox

This is a list of discrepencies I came across while trying to while cross-system compatible makefiles and Bash scripts.

sed

-i (in-place editing) can work without an argument with GNU sed, but won't work without an argument on BSD sed and on Busybox.

@maelvls
maelvls / Makefile
Last active January 23, 2023 12:02
Exemple de Makefile où j'ai noté tout ce que j'avais appris sur Makefile/make
#
# ANCIEN MAKEFILE Inutile maintenant ; on utilisera ./configure; make
#
# makefile
# Mael Valais, 2014-04-07 15:23
#
# Makefile permettant la compilation du projet climso-auto
# NOTE: les # */ sont là à cause de Xcode
#
# A faire :