Skip to content

Instantly share code, notes, and snippets.

@brahimmachkouri
brahimmachkouri / monitor_dashboard.py
Created April 11, 2025 17:14
Dashboard pour monitorer une machine sous Ubuntu
#!/bin/python3
# Paquets requis : nvidia-utils, python3, python3-pip, pip3, lm-sensors, nvme-cl, 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
Created April 11, 2025 16:47
Ubuntu : Install Docker
#!/bin/bash
set -e
# Vérifie si sudo est disponible
if ! command -v sudo &>/dev/null; then
echo "❌ sudo n'est pas installé. Abandon."
exit 1
fi
@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 / multipass_cheatsheet.md
Last active January 26, 2025 21:40
Multipass cheatsheet

Multipass Cheat Sheet

Command Description
multipass launch --name <name> --memory <size> Launch a new VM with specified RAM. Example: --memory 4G for 4 GB of RAM.
multipass launch --name <name> --disk <size> Launch a new VM with specified disk space. Example: --disk 20G for 20 GB.
multipass launch --name <name> --cpus <count> Launch a new VM with specified number of CPUs. Example: --cpus 2 for 2 CPUs.
multipass transfer <file> <vm-name>:<destination> Copy files from the host to the specified VM.
multipass transfer : Copy files from the VM to the host.
@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 October 29, 2024 08:29
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">