Skip to content

Instantly share code, notes, and snippets.

View etiennecollin's full-sized avatar
🍀

Etienne Collin etiennecollin

🍀
View GitHub Profile
@etiennecollin
etiennecollin / installing_fixing_ghdl_on_macos.md
Last active January 22, 2024 18:58
Installing and Fixing GHDL on macOS

Installing GHDL successfully on macOS

The Problem

Homebrew installs the LLVM version of GHDL. Unfortunately, currently, there is an issue with Apple's LLVM and GHDL. Hence, we will use the mcode version of GHDL.

The Solution

@etiennecollin
etiennecollin / 0_base_encoding_converter.py
Last active January 18, 2024 06:28
Convert the encoding of a number from a BaseX to a BaseY encoding where x and y are each between [2, 36].
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Etienne Collin
# Date: 2022/09/15
# Copyright: Copyright 2022, Etienne Collin
# Email: collin.etienne.contact@gmail.com
# License: GPL-3.0
# Version: 1.3.0
@etiennecollin
etiennecollin / 0_memory_leaks_analysis_c.md
Last active January 29, 2024 20:45
Memory leaks analysis for C on macOS, Windows and Linux

Memory Leaks Analysis for C on macOS, Windows and Linux

Here, two different methods are presented to analyse memory leaks in C code.

The first method is cross-platform. It uses a small Docker image to both run Valgrind on the code and execute the code with the AddressSanitizer.

The second method is exclusive to macOS. It runs leaks on the code and is a bit simpler than the first method in that it does not use Docker. leaks should be as performant as Valgrind (although Valgrind has more features and could potentially catch memory leaks that leaks cannot catch).


@etiennecollin
etiennecollin / fft.py
Last active December 10, 2023 03:30
This script provides a function to compute the Cooley-Tukey Radix-2 Decimation in Time (DIT) Fast Fourier Transform (FFT) on a given input vector.
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Etienne Collin
# Date: 2023/12/09
# Email: collin.etienne.contact@gmail.com
"""
This script provides a function to compute the Cooley-Tukey Radix-2 Decimation in Time (DIT)
Fast Fourier Transform (FFT) on a given input vector. Additionally, the script may be run
@etiennecollin
etiennecollin / office_to_pdf.sh
Last active February 7, 2024 19:30
This is a script to convert Office files to PDF using LibreOffice
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
# Author: Etienne Collin
# Date: 2023/05/20
# Updated: 2024/02/07
# Email: collin.etienne.contact@gmail.com
###############################################################################
# This is a script to convert Office files to PDF using LibreOffice.
@etiennecollin
etiennecollin / makefile_vhdl
Last active June 6, 2024 10:58
Easily compile and simulate VHDL entities using GHDL and GTKWave. See instructions in the top comment.
# By Etienne Collin
# https://gist.github.com/etiennecollin/198f7520c4c58d545368a196e08f83ed
# Dependencies (on macOS, install via Homebrew (https://brew.sh/)):
# ghdl:
# Source: https://github.com/ghdl/ghdl/
# gtkwave:
# Source: https://gtkwave.sourceforge.net/
#### INPUT REQUIRED ####
ENTITIES = entityName1 entityName2
@etiennecollin
etiennecollin / rcd.sh
Last active July 15, 2023 14:32
This modified version of the cd command will recursively cd into directories that contain a single subdirectory. You may append this code to your shell config file (such as .zshrc, .bashrc, etc...).
function rcd {
# Check that number of arguments is 1
if [ $# -ne 1 ]; then
echo "Please input the path to a directory as the argument."
return 0
fi
# Store the given path as a variable
dirpath=$1
@etiennecollin
etiennecollin / file_system_formatter.py
Last active January 9, 2024 06:31
The File System Formatter script is a Python program that automates the process of formatting file and directory names within a file system. It applies a set of rules to ensure consistent naming conventions and improve organization. The script allows users to customize the formatting options and provides options for dry run and verbose output.
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Etienne Collin
# Date: 2023/12/20
# Email: collin.etienne.contact@gmail.com
################################################################################
# The File System Formatter script is a Python program that automates the process of formatting file and
# directory names within a file system. It applies a set of rules to ensure consistent naming conventions and
@etiennecollin
etiennecollin / github_updater.py
Last active November 28, 2022 22:06
This small script will fetch and pull every repository that is cloned in the ~/github folder on my computer.
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Etienne Collin
# Date: 2022/11/25
# Email: collin.etienne.contact@gmail.com
import os
githubFolderPath = os.path.expanduser("~/github")