Skip to content

Instantly share code, notes, and snippets.

@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 May 30, 2025 18:51
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 "$1 introuvable"; 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"
@brahimmachkouri
brahimmachkouri / gdb-pwndbg.md
Created January 2, 2025 20:27
GDB/Pwndbg mémo

Déboguer un Programme avec GDB et Pwndbg

Ce tutoriel couvre les bases de l'utilisation de GDB avec l'extension Pwndbg pour déboguer des programmes en C ou des exécutables ELF.


1. Installation de GDB et Pwndbg

  1. Installer GDB :
@brahimmachkouri
brahimmachkouri / oci8_install.sh
Last active May 3, 2025 11:18
Installation de oci8
#!/bin/bash
# BM 20240830
# Testé avec Ubuntu 22.04, PHP 8.3 (Ondrej Sury) & Oracle Instant Client 21.15
# Vérification que le script est exécuté en tant qu'administrateur (root)
if [[ $EUID -ne 0 ]]; then
echo "Ce script doit être exécuté en tant qu'administrateur (root)."
exit 1
fi
@brahimmachkouri
brahimmachkouri / 2024-08-22-connexion-a-ms-sql-server-en-php-sous-ubuntu.md
Created August 22, 2024 10:02
Connexion à MS SQL Server en PHP sous Debian/Ubuntu
layout date title category tags
post
2024-08-22 04:40:00 -0700
Connexion à MS SQL Server en PHP sous Debian/Ubuntu
dev
mssql php ubuntu

Remarque : la procédure suivante a été réalisée pour une version 7.2 de PHP. Il se peut que vous deviez adapter quelques points...

@brahimmachkouri
brahimmachkouri / sources.list
Created September 2, 2023 14:25
Ubuntu Jammy repositories
deb http://fr.archive.ubuntu.com/ubuntu/ jammy main restricted
deb http://security.ubuntu.com/ubuntu jammy-security main restricted
deb http://fr.archive.ubuntu.com/ubuntu/ jammy-updates main restricted
deb http://fr.archive.ubuntu.com/ubuntu/ jammy universe multiverse
deb http://security.ubuntu.com/ubuntu jammy-security universe multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ jammy-updates universe multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
@brahimmachkouri
brahimmachkouri / fabricjs_draw_rectangle.html
Last active November 25, 2022 13:56
Fabric.js : how to draw a rectangle with the mouse
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>fabric Creating rect with a mouse</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">