Skip to content

Instantly share code, notes, and snippets.

View tristan0x's full-sized avatar

Tristan Carel tristan0x

View GitHub Profile
"""Script used to extract audio tracks from MP4 videos to MP3
with ffmpeg. The script processes multiple files simultaneously.
Examples:
# To extract the audio track from my-video.mp4
# and write it in my-videos.mp3:
python3 mp4tomp3.py my-video.mp4
# the script accepts multiple arguments
#include <initializer_list>
template <int... Values>
struct integer_sequence {};
template <std::size_t Size, int...Accu>
struct ones_traits {
using type = typename ones_traits<Size - 1, 1, Accu...>::type;
};
// This gist intends to provide an helper function to create
// std::initializer_list of a certain size with a fixed value.
// 2 implementations are available:
//
// 1. the `constant_int`: only support integer values
// 2. the `constant`: support any kind of value
//
// This piece of code requires C++17 standard
// use-case:
@tristan0x
tristan0x / Makefile
Last active October 9, 2022 11:38
How to use C++ explicit instantiation to hide implementation of template class or member
SOURCES = foo.cc bar.cc
CXXFLAGS = -Wall -ansi -pedantic -Werror
all: main
main: $(SOURCES:.cc=.o)
$(CXX) $? -o $@
clean:
$(RM) $(SOURCES:.cc=.o)
@tristan0x
tristan0x / packages.yaml
Last active September 4, 2018 12:52
Spack config on MacOS
packages:
# gcc:
# paths:
# gcc@4.9.4%gcc@4.4: /usr/local
# buildable: False
# version: [4.9.4]
llvm:
paths:
llvm@8.0.0-apple%gcc@4.4: /usr/local
@tristan0x
tristan0x / git.md
Last active October 6, 2017 06:48
Git Tip & Tricks

Install latest git

On Ubuntu:

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get upgrade
/*
MIT License
Copyright (c) 2017 Tristan CAREL
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@tristan0x
tristan0x / README.md
Last active August 2, 2017 09:06
C++ mass renaming

Ctags

List of all kind symbols that can be extracted

$ ctags --list-kinds=C++
c  classes
d  macro definitions
e  enumerators (values inside an enumeration)
f  function definitions
---
Language: Cpp
BasedOnStyle: LLVM
AlwaysBreakTemplateDeclarations: true
BraceWrapping:
FixNamespaceComments: true
IndentWidth: 4
PointerAlignment: Left
@tristan0x
tristan0x / .clang-format
Last active December 13, 2017 14:32
Blue Brain Project HPC team C++ coding style
---
Language: Cpp
BasedOnStyle: LLVM
AlwaysBreakTemplateDeclarations: true
BraceWrapping:
FixNamespaceComments true
IncludeCategories:
IndentWidth: 4
PointerAlignment: Left