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 / .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
@fsimonis
fsimonis / ghco
Created April 26, 2023 12:48
Script using FZF and gh-cli to interactively checkout a PR. PR number and title are fuzzily searched using fzf
#! bash
# Created by Frédéric Simonis
# May it bring you joy and preserve your sanity
if [ $# -eq 0 ]; then
gh pr list -L 999 --json number,title -t \
'{{range .}}{{tablerow (printf "#%v" .number | autocolor "green") .title}}{{end}}' \
| fzf --ansi \
| sed "s/^#\([0-9]\+\).*/\1/" \
| xargs gh pr checkout
@fsimonis
fsimonis / focusrite.conf
Last active February 10, 2024 05:43
Pipewire remapping of Focusrite Scarlett 2i4 to mono input and stereo output
# This is a remapping of the Focusrite Scarlett 2i4 to Mono input and Stereo output
# Place this file in ~/.config/pipewire/pipewire.conf.d/
# Then reload pipewire sudo systemctl reload --user pipewire.service
# Use pw-link --input and pw-link --output to find the name of the output and input device.
# The list will contain one line per port, but you will need the name of the device node.
# The format is <name of the device node>:<name of the port>.
# We need to configure two loopback modules. One for the sink and one of the source
context.modules = [
@fsimonis
fsimonis / README.md
Last active December 9, 2021 14:50
Quick branch/PR switcher for GitHub based on fzf

Script based on github-cli and fzf to switch branches and PRs super quickly.

Calling it with arguments will forward them to gh pr checkout.

Calling it with no arguments displays a fuzzy search of PR numbers and titles. Selecting an entry will checkout that PR.

@fsimonis
fsimonis / 91-pulseaudio-focusrite.rules
Created February 27, 2021 12:58
Focusrite Scarlett 2i4 pulseaudio profile
# File /lib/udev/rules.d/91-pulseaudio-focusrite.rules
# To get the idVendor and idProduct first unplug the device, then start dmesg -w and plug the device back in. It should show up on the screen.
SUBSYSTEM!="sound", GOTO="pulseaudio_end"
ACTION!="change", GOTO="pulseaudio_end"
KERNEL!="card*", GOTO="pulseaudio_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1235", ATTRS{idProduct}=="8200", ENV{PULSE_PROFILE_SET}="focusrite-2i4.conf"
LABEL="pulseaudio_end"