Skip to content

Instantly share code, notes, and snippets.

View fsimonis's full-sized avatar

Frédéric Simonis fsimonis

View GitHub Profile
@fsimonis
fsimonis / mem.py
Created April 24, 2026 08:26
Memory footprint comparison of python classes
import sys
from abc import ABC, abstractmethod
class DictBase(ABC):
@abstractmethod
def do(self):
pass
class SlotBase(ABC):
@fsimonis
fsimonis / guide.md
Last active March 25, 2026 10:24
Finding Grammarly Client ID
  1. Install Firefox Grammarly extension and login
  2. Go to about:debugging#/runtime/this-firefox find Grammarly and click Inspect
  3. In the new window open the tab Storage
  4. Open the "Extension Storage" tab and click on the moz-extension entry.
  5. On the right find the key user
  6. The entry id contains the Grammarly client/user ID
@fsimonis
fsimonis / wl-copyfile
Created September 3, 2025 14:58
Copy file uri from terminal to paste in GUI applications
#!bash
echo -n "file://$( readlink -f $@ )" | wl-copy -t "text/uri-list"
@fsimonis
fsimonis / README.md
Created November 19, 2024 10:03
Tool to expand CMake unity builds for clangd support

deunify

This tool exands the compile_commands.json of unity build files generated by CMake to enable clangd support.

Without this, clangd doesn't know what to do with the compilation units.

Default file is compile_commands.json in the current working directory. Outputs to console by default. Use -i to update in-place.

To use:

@fsimonis
fsimonis / .latexmkrc
Created April 19, 2024 11:23
Latexmkrc quickstart - you won't need more
# Setup directory with extra packages and documentclasses
ensure_path( 'TEXINPUTS', './extra//' );
# Setup out directory
$out_dir = 'build';
# Setup main file
@default_files = ( 'main.tex' );
# Setup command options (use -shell-escape only if necessary)
@fsimonis
fsimonis / org.precice.configvisualizer.desktop
Last active April 12, 2024 08:39
Desktop file for precice-config-visualizer-gui using pipx
[Desktop Entry]
Name=preCICE Config Visualizer
Comment=Visualize preCICE configuration files
Exec=sh -c "$HOME/.local/bin/precice-config-visualizer-gui %f"
Terminal=false
Type=Application
Categories=Development
MimeType=application/xml
StartupNotify=true
StartupWMClass=preciceconfigvisualizer
@fsimonis
fsimonis / README.md
Last active February 16, 2024 12:40
OhMyZsh plugin to stay in the same directory when opening a new terminal. Works with zoxide

persistent-term

This is a plugin for oh-my-zsh.

It keeps track of the last directory you cd to. When starting a new terminal, it automatically cds to that directory again. If zoxide is loaded, then the plugin uses __zoxide_z instead of cd.

This is very useful if you want to quickly start two terminals, one for a source directory and one for a build directory. You start in one terminal and cd to the source. Then you open a new terminal, which starts in the same directory an you cd to the build directory.

@fsimonis
fsimonis / README.md
Last active September 22, 2024 20:05
Copy path to file as URI to xclip clipboard.

xclip-copy-fileuri

Use this tool to copy a path to a file in a terminal if you want to paste it in a GUI.

The tool

  • looksup the absolute path of the file
  • formats a file:// uri
  • passes it to xclip with the target text/uri-list
@fsimonis
fsimonis / git-worktree-changer.sh
Created May 5, 2023 10:49
A bash script to change between git worktrees in a terminal using fzf.
changeworktree()
{
WT=$(git worktree list --porcelain | sed -e "/^HEAD/d" -e "/^$/d" -e "s/^worktree //" -e "s/branch refs\/heads\/\(.\+\)/\1/" | paste -d '\t' - - | column -t --output-separator=$'\t' | fzf --ansi | cut -f1 -d' ' )
[ -n "$WT" ] && cd $WT
}
alias cdgw="changeworktree"
@fsimonis
fsimonis / precice-run-tests
Last active October 15, 2024 11:46
Script to run tests of preCICE one by one
#! python
import subprocess
import concurrent.futures
from colorama import Style, Fore
import sys
import pathlib
import tempfile
import os
import collections