Skip to content

Instantly share code, notes, and snippets.

Matthieu Talbot MartyLake

  • Expressive
  • France
Block or report user

Report or block MartyLake

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MartyLake
MartyLake / .bash_rc
Created Nov 29, 2018
Bash alias to format files that changed before commit
View .bash_rc
#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 Nov 7, 2018
compile_commands.json
View readme.md
View corelibs-arduino101-pre-commit
#!/bin/sh
#
# This pre-commit hook checks if clang-format-7
# is installed, and if so, uses the installed version to format
# the staged changes.
#
# Installation instructions from : https://github.com/arduino/ArduinoCore-arc32/wiki/Creating-a-pre-commit-hook-for-clang-format
# cd your-repository
# curl https://gist.githubusercontent.com/MartyLake/17ecdf00d6036b0f5773fa7bcd313e69/raw > .git/hooks/pre-commit
# chmod a+x .git/hooks/pre-commit
@MartyLake
MartyLake / .vimrc
Last active Mar 22, 2019
bootstrap script to generate compile_commands.json and clang complete on project that uses cmake and vim
View .vimrc
" only use linters that uses compile_commands.json
let g:ale_linters.cpp = ['clangcheck', 'clangtidy', 'cppcheck']
" various options for clang_complete
set concealcursor=inv
let g:clang_snippets = 1
set completeopt=menu,longest
let g:clang_complete_optional_args_in_snippets = 1
let g:clang_trailing_placeholder = 1
@MartyLake
MartyLake / Makefile
Created Nov 17, 2017
Notify when long operation completes
View Makefile
all:
long_operation.sh
notify:
display -resize 1000x1000 '${HOME}/done.jpg'
#if you want to get notified at the end of long operetion, just use:
# ’make all notify’
@MartyLake
MartyLake / Makefile
Created Nov 6, 2017
makefile uses an embedded python script to populate a local variable
View Makefile
#from https://stackoverflow.com/questions/17125269/embed-python-in-makefile-to-set-make-variables
define NEWLINE
endef
define DETECT_SDK
import os
locations = [
@MartyLake
MartyLake / filter_file.sh
Created Sep 19, 2017
filters a big file quickly with bash
View filter_file.sh
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
input_file="in.csv"
output_file="out.csv"
NUMOFLINES=$(wc -l < ${input_file})
it=0
@MartyLake
MartyLake / consolidateM3u.sh
Created May 28, 2017
consolidate m3u files to a folder
View consolidateM3u.sh
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
#set -x #debug mode
HELPSTRING="Usage:
$ sh consolidateM3u.sh -p \"./playlist.m3u\" -o \"./outputDir/\""
function printHelp {
echo "$HELPSTRING"
}
@MartyLake
MartyLake / Create an album: Normalize all wav volume and convert all wav to mp3
Last active Aug 4, 2019 — forked from championofblocks/wav-mp3
Create an album: Normalize all wav volume and convert all wav to mp3
View Create an album: Normalize all wav volume and convert all wav to mp3
# from http://normalize.nongnu.org/README.html
normalize -bv *.wav
# from https://gist.github.com/championofblocks/3982727
for i in *.wav; do lame -b 320 -h "${i}" "${i%.wav}.mp3"; done
# from https://askubuntu.com/questions/65331/how-to-convert-a-m4a-sound-file-to-mp3
# + https://askubuntu.com/questions/385636/what-is-the-proper-way-to-convert-flac-files-to-320-kbit-sec-mp3
find . -type f -name '*.m4a' -exec bash -c 'avconv -i "$0" -qscale:a 0 "${0/%m4a/mp3}"' '{}' \;
View .vimrc
set encoding=utf-8 " The encoding displayed.
set fileencoding=utf-8 " The encoding written to file.
set guifont=Source_Code_Pro:h12:cANSI:qDRAFT
set syntax=on
set backspace=2 " make backspace work like most other apps
set whichwrap+=<,>,h,l,[,] "left and right will go back to previous/next line
set number "display line numbers
set nolist "IDK, related to wrap and linebreak
set wrap "wrap text when window is too short
You can’t perform that action at this time.