Skip to content

Instantly share code, notes, and snippets.

View gaspardpetit's full-sized avatar

Gaspard Petit gaspardpetit

  • Montréal, Canada
View GitHub Profile
@gaspardpetit
gaspardpetit / plantuml-doc-202503.md
Last active February 13, 2026 09:22
PlantUML (2025.3) Documentation

PlantUML usage guide

Applicable version: this documentation is based on PlantUML 1.2025.3 (June 2025), which introduces new syntaxes (notably CSS-style styling) and removes some legacy commands.

PlantUML is a text‑based language for creating both UML and non‑UML diagrams. Every diagram starts with @start… and ends with @end…. The type of diagram is defined in the start tag (uml, mindmap, nwdiag, etc.). Comments are written with // or /'…'/. The title, header, footer, legend and caption directives are common to all diagrams and add contextual information.

1 General principles

1.1 Start and end tags

@gaspardpetit
gaspardpetit / bash
Created December 21, 2024 17:08
Profiling in Python
python -m cProfile -o profile_results.prof my_script.py
snakeviz profile_results.prof
@gaspardpetit
gaspardpetit / ConvertLatexToWord.vb
Last active June 22, 2024 21:00
VB Macro to Convert LaTeX to Word Equations
Sub ConvertLatexToWord()
Dim selectedRange As Range
Dim startPos As Long
Dim endPos As Long
Dim equationText As String
Dim insertRange As Range
Dim undoRecord As undoRecord
Dim equations As Collection
Dim eqRange As Range
@gaspardpetit
gaspardpetit / activity.plantuml
Last active January 30, 2025 18:18
Plantuml Activity Diagram Template for Patent Figures
@startuml
!theme plain
hide empty description
skinparam defaultFontName Arial
skinparam defaultFontSize 16
skinparam activityFontSize 16
skinparam activityDiamondFontSize 16
skinparam activityArrowFontSize 14
skinparam footerFontSize 24
@gaspardpetit
gaspardpetit / diarize_nemo.py
Created December 28, 2023 02:40
Diarization sample using NVidia NeMo
import os
import wget
import json
import logging
from omegaconf import OmegaConf
from pyannote.core import Annotation
import torch
from nemo.collections.asr.models import ClusteringDiarizer, NeuralDiarizer
from nemo.collections.asr.parts.utils.speaker_utils import rttm_to_labels, labels_to_pyannote_object
@gaspardpetit
gaspardpetit / diarization_pyannote.py
Created December 27, 2023 03:48
diarization using pyannote
import os
import torch
import torchaudio
import logging
from pyannote.audio import Pipeline
from pyannote.core import Annotation
from pyannote.audio.pipelines.speaker_diarization import SpeakerDiarization
from pyannote.audio.pipelines.utils.hook import ProgressHook
# Environment variable to use for setting the HuggingFace Token
@gaspardpetit
gaspardpetit / pci-table.md
Last active September 12, 2025 09:52 — forked from cuteribs-1/pci-table.md
PCI Vendor Data Table
Vendor Id Vendor Name
0x0014 Loongson Technology LLC
0x001C PEAK-System Technik GmbH
0x0033 Paradyne Corp.
0x003D Lockheed Martin-Marietta Corp
0x0070 Hauppauge computer works Inc.
0x0071 Nebula Electronics Ltd.
0x0100 nCipher Security
0x0123 General Dynamics
@gaspardpetit
gaspardpetit / PureFromPlainC.cpp
Created February 27, 2022 16:13
Sample code to demonstrate how to implement a C++ object in plan C; Works only in Microsoft VS - where the vtable starts with the function pointers, as used by COM objects
#include <new>
///////
// Sample code to demonstrate how to implement a C++ object in plan C
// Works only in Microsoft VS - where the vtable starts with the function
// pointers, as used by COM objects
///////
// The C++ interface we wish to implement

Using nmcli to configure a hostspot in bridge mode

My objective is to share my ethernet connection over my wifi under Ubuntu 21.10 in bridge mode (so avoiding NAT and letting the devices connected over the wifi to obtain their IP from the same gateway as the host)

Identify the devices

First find your devices using ip a, in my case I will be bridging

@gaspardpetit
gaspardpetit / TestScopeTest.java
Last active December 13, 2020 00:15
Google Guice TestScope
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.OutOfScopeException;
import com.google.inject.Provider;
import com.google.inject.Scope;
import com.google.inject.ScopeAnnotation;
import com.google.inject.Scopes;
import org.junit.jupiter.api.AfterEach;