Skip to content

Instantly share code, notes, and snippets.

View tristan0x's full-sized avatar

Tristan Carel tristan0x

  • Geneva area, France
  • 07:57 (UTC +02:00)
View GitHub Profile
@tristan0x
tristan0x / packages.yaml
Last active September 4, 2018 12:52
Spack config on MacOS
packages:
# gcc:
# paths:
# [email protected]%[email protected]: /usr/local
# buildable: False
# version: [4.9.4]
llvm:
paths:
[email protected]%[email protected]: /usr/local
@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)
// 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:
#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;
};
"""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