Skip to content

Instantly share code, notes, and snippets.

View MartyLake's full-sized avatar

Matthieu Talbot MartyLake

  • Expressive
  • France
View GitHub Profile
@MartyLake
MartyLake / .vimrc
Last active September 21, 2024 22:01
vimwiki table formula integration
set nocompatible
filetype off
let vundleVimPath = "~/.vim/bundle/Vundle.vim"
let vundleVimInstallPluginPath = "$HOME/.vim/bundle"
exe 'set rtp+=' . expand(vundleVimPath)
call vundle#begin(vundleVimInstallPluginPath)
Plugin 'VundleVim/Vundle.vim'
"" End of Vundle package manager preamble
"""""""""""""""""""""""""""""""""""""""""
@MartyLake
MartyLake / gist:01c42a805e144f759d9b4c4e4cb3e8c4
Created March 14, 2024 19:04
convert ffmpeg video to vertical with overlay
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
set -x
FILTERGRAPH="[0:v]pad=iw:2*trunc(iw*16/18):(ow-iw)/2:(oh-ih)/2[padded];[padded]scale=1080:1920[resized];[resized][1:v]overlay"
echo "nullscr,$FILTERGRAPH,nullsink" | graph2dot
false
for f in $(find input -type f); do
@MartyLake
MartyLake / .envrc
Last active July 11, 2023 09:10
Deal with multiple git identities
export GIT_SSH_COMMAND="ssh -o IdentitiesOnly=yes -i ~/.ssh/id_ed25519_example -F /dev/null"
export GIT_AUTHOR_NAME='example'
export GIT_AUTHOR_EMAIL='[email protected]'
export GIT_COMMITTER_NAME='example'
export GIT_COMMITTER_EMAIL='[email protected]'
ssh-add -l | grep example || ssh-add ~/.ssh/id_ed25519_example
@MartyLake
MartyLake / unpaper.sh
Created October 9, 2022 22:54
unpaper example
# folder repository
# ./ #<-- destination folder
# ./originals/any.pdf #<-- any number of pdfs to convert, originals
# ./originals/unpaper.sh #<-- this script
# inspired from https://gist.github.com/legumbre/1182280/60c3bfc13b9d89b57fef733f67ad60de2624be6a
set -x
for i in *.pdf; do
gs -q -dNOPAUSE -dBATCH -sDEVICE=ppmraw -sOutputFile=%04d.ppm "$i"
for f in *.ppm; do
@MartyLake
MartyLake / crontab
Last active November 17, 2021 22:39
docker-compose
# check if all docker-compose containers are properly running
bash -c "(diff <(cd /srv && /usr/bin/local/docker-compose ps --services --filter "status=running") <(cd /srv && /usr/bin/local/docker-compose ps --services) || /usr/bin/local/docker-compose up -d) >> /var/log/crontab-root-dbg.log"
@MartyLake
MartyLake / .local.vimrc
Last active February 12, 2021 22:16
.local.vimrc
"call make from the root folder
let &l:makeprg = 'cd ' . expand('<sfile>:p:h') . ' && make'
augroup fix_path_for_catch2_output_results
autocmd!
au QuickFixCmdPre * lcd <sfile>:p:h/build
augroup END
@MartyLake
MartyLake / compile_commands_to_gtags_files.sh
Last active November 26, 2019 14:34
convert compile_commands.json to gtags.files
[ -f "compile_commands.json" ] || echo "compile_commands.json not found." ; return -1
grep '"file"' compile_commands.json | sed -E 's/.*"..\/..\/..\/(.*)",/\1/' > gtags.files
global -u
@MartyLake
MartyLake / generate_compile_commands.py
Created September 27, 2019 12:56
Generate compile_commands.json from a cmakelists.txt file
""" a big WIP, as I discovered that VS2019 supports the export """
import os
import subprocess
import shutil
import contextlib
import tempfile
SRC_DIR=(os.path.dirname(os.path.realpath(__file__)))
@contextlib.contextmanager
@MartyLake
MartyLake / .bash_rc
Created November 29, 2018 10:38
Bash alias to format files that changed before commit
#format only files that have a diff
alias gformat="git diff --name-only --ignore-submodules | xargs -I {} sh -c 'export f="{}"; cd \$(git rev-parse --show-toplevel) && [[ -f \$f ]] && echo formatting \$f && clang-format -i --style=file \$f || echo directory \$f'"
#fix osx gitgui bug + format all files + open git gui and gitk (I use these a lot to commit)
alias gh="git config --local --unset gui.geometry && git push& gformat && git gui & gitk &"
@MartyLake
MartyLake / readme.md
Created November 7, 2018 13:13
compile_commands.json