Skip to content

Instantly share code, notes, and snippets.

@brahimmachkouri
brahimmachkouri / MacBook-check-trackpad.md
Created December 11, 2025 14:13
MacBook trackpad Check

Guide pas à pas – Trackpad de MacBook qui ne fonctionne plus

Ce document détaille, étape par étape, ce qu’il faut faire quand un MacBook arrive avec un trackpad qui ne fonctionne plus (ou mal).
Objectif : déterminer si le problème vient du logiciel, du matériel, ou d’une batterie qui gonfle, puis décider quoi faire.


0. Précautions de base

@brahimmachkouri
brahimmachkouri / chat-sidebar.js
Created December 3, 2025 15:14
Réglage de la taille de la sidebar ChatGPT
// ==UserScript==
// @name ChatGPT Sidebar Width Controller
// @namespace https://tampermonkey.net/
// @version 2.0
// @description Permet de changer dynamiquement la largeur de la sidebar ChatGPT via un menu Tampermonkey
// @author BM
// @match https://chat.openai.com/*
// @match https://chatgpt.com/*
// @grant GM_registerMenuCommand
// @grant GM_setValue
@brahimmachkouri
brahimmachkouri / cpxs.sh
Created November 15, 2025 17:15
Crée une archive tar.xz compressée de manière sécurisée en utilisant la compression parallèle XZ
#!/usr/bin/env bash
# cpxs.sh — tar -> xz parallèle, safe by default
# Usage: ./cxps.sh -s /chemin/du/repertoire [-o sortie.tar.xz] [-t threads] [-l level] [-e exclude] [-p] [-v] [-F] [-h]
# Voir exemples en bas.
set -euo pipefail
IFS=$'\n\t'
prog=$(basename "$0")
usage() {
@brahimmachkouri
brahimmachkouri / flattenrepo.py
Last active October 11, 2025 06:34
Création d'un document Markdown contenant l'arborescence et le contenu des fichiers d'un projet de développement d'application
#!/usr/bin/env python3
# BM 20251011
import os
import tempfile
import subprocess
import shutil
import argparse
import zipfile
# Répertoires susceptibles d'être exclus par défaut
@brahimmachkouri
brahimmachkouri / pdf_to_cbx.py
Created August 30, 2025 16:09
Conversion PDF -> CBZ/CBR
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
pdf_to_cbx.pyConvertir un PDF en CBZ (ou CBR si 'rar' est disponible)
=======================================================================
Dépendances Python : PyMuPDF (pymupdf), Pillow
Installation rapide :
pip install --upgrade pymupdf pillow
@brahimmachkouri
brahimmachkouri / install_portainer.sh
Last active May 30, 2025 19:07
Ubuntu : install Portainer
#!/usr/bin/env bash
set -euo pipefail
cleanup() { [[ -n "${SUDO_LOOP_PID:-}" ]] && kill "$SUDO_LOOP_PID"; }
trap cleanup EXIT
command -v sudo >/dev/null || { echo "❌ sudo manquant"; exit 1; }
sudo -v
( while true; do sudo -n true; sleep 60; done ) & SUDO_LOOP_PID=$!
@brahimmachkouri
brahimmachkouri / monitor_dashboard.py
Last active May 21, 2025 14:25
Dashboard pour monitorer une machine sous Ubuntu
#!/bin/python3
# Paquets requis : nvidia-utils, python3, python3-pip, lm-sensors, nvme-cli, smartmontools, docker.io
# Libs python :
# pip3 install psutil textual rich
# 'r' pour recharger, 'q' pour quitter
from textual.app import App, ComposeResult
from textual.containers import Horizontal, Vertical
from textual.widgets import Static
from textual.reactive import reactive
@brahimmachkouri
brahimmachkouri / install_docker.sh
Last active August 6, 2025 15:27
Ubuntu : Install Docker
#!/usr/bin/env bash
set -euo pipefail
# ---------- Fonctions ----------
cleanup() { [[ -n "${SUDO_LOOP_PID:-}" ]] && kill "$SUDO_LOOP_PID"; }
trap cleanup EXIT
need_cmd() { command -v "$1" &>/dev/null || { echo -e "\e[31m❌ $1 introuvable\e[0m"; exit 1; }; }
need_cmd sudo
@brahimmachkouri
brahimmachkouri / xubuntu_azerty_apple.sh
Created April 3, 2025 09:39
Installation d'un clavier Apple sous Ubuntu server 22.04 avec Xubuntu
#!/usr/bin/env bash
set -e
echo "==== Configuration clavier Apple AZERTY pour Ubuntu Server 22.04 avec Xubuntu ===="
############################################
# 1. Configuration LightDM pour session Xubuntu + clavier AZERTY Apple
############################################
LIGHTDM_DIR="/etc/lightdm/lightdm.conf.d"
LIGHTDM_CONF="${LIGHTDM_DIR}/00-azerty-apple.conf"
@brahimmachkouri
brahimmachkouri / install_xubunvidia.sh
Created April 3, 2025 07:28
Install GUI sur Ubuntu server 22.04 + Nvidia drivers + CUDA
#!/usr/bin/env bash
# Install de l'interface xubuntu sur Ubuntu Server 22.04
# Install des drivers Nvidia + CUDA
# Install de tools
set -e
# === VARIABLES DE VERSION ===
NVIDIA_DRIVER_VERSION="550"
CUDA_VERSION="12-4"