Skip to content

Instantly share code, notes, and snippets.

View mpoullet's full-sized avatar

Matthieu Poullet mpoullet

View GitHub Profile
struct Connection {
void disconnected()
{
m_connection = Disconnected();
}
void interrupted()
{
m_connection = std::visit(InterruptedEvent(*this), m_connection);
}
@mpoullet
mpoullet / multihooks.py
Last active May 18, 2017 07:27 — forked from carlos-jenkins/multihooks.py
Delegating script for multiple git hooks
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Carlos Jenkins <carlos@jenkins.co.cr>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@mpoullet
mpoullet / collegerama.sh
Created June 5, 2017 18:02 — forked from mnstrspeed/collegerama.sh
Download video lectures from TU Delft Collegerama (december 2015). Requires `wget`, `curl`, and `jq` (available in Ubuntu/Debian repositories).
#!/bin/bash
# resource ID of the video, can be obtained from the video URL:
# https://collegerama.tudelft.nl/Mediasite/Play/485dbc9fac81446bae6b2ba2fe0571ac1d?catalog=cf028e9a-2a24-4e1f-bdb5-2ace3f9cd42d
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
id=$1
SERVICE_ENDPOINT="https://collegerama.tudelft.nl/Mediasite/PlayerService/PlayerService.svc/json/GetPlayerOptions"
params="{\"getPlayerOptionsRequest\":{\"ResourceId\":\"${id}\",\"QueryString\":\"?catalog=cf028e9a-2a24-4e1f-bdb5-2ace3f9cd42d\",\"UseScreenReader\":false,\"UrlReferrer\":\"\"}}"
#include <cassert>
#include <memory> // std::addressof
template<typename ResourceTag, typename ResourceType> class Resource {
public:
Resource() noexcept = default;
explicit Resource(ResourceType resource) noexcept : resource_{ resource } {}
Resource(const Resource&) = delete;
Resource& operator=(const Resource&) = delete;
@mpoullet
mpoullet / Apprendre et explorer ES2015plus.md
Created January 17, 2018 14:35 — forked from tdd/Apprendre et explorer ES2015plus.md
De bonnes ressources pour apprendre, découvrir et explorer ES2015+ en profondeur

Apprendre

  • ES6 Katas - De petits exercices courts pour découvrir la plupart des aspects des fonctionnalités ES2015+ de façon interactive. Plutôt top.
  • Learn ES2015 - Une partie géniale du site web de Babel qui déroule des exemples de toutes les fonctionnalités ES2015+ prises en charge.
  • ES6-Features.org - Chouette comparaison point à point de codes utilisant ES2015+ et de leur équivalent ES5.
  • ES6 Features - Une revue rapide, sur une page unique, des fonctionnalités ES2015 à coup d'exemples de code, par Luke Hoban.

Explorer en profondeur

  • ES6 In Depth - Super série d’articles sur le Mozilla Developer Network (MDN) ; également disponible en français grâce à un considérable effort de traduction.
@mpoullet
mpoullet / todo.h
Created January 23, 2018 12:31 — forked from twoscomplement/todo.h
TODO(): A macro that will fire a static assert if compiled on or after a specified date. Requires C++11.
/*
todo.h
TODO():
A macro that will fire a static assert if compiled on or after
a specified date.
Requires C++11 constexpr support.
@mpoullet
mpoullet / prime.cpp
Created February 2, 2018 12:33 — forked from rongjiecomputer/prime.cpp
Sieve of Eratosthenes with C++ constexpr
#include <stdio.h>
template <size_t N>
struct PrimeTable {
constexpr PrimeTable() : sieve() {
sieve[0] = sieve[1] = false;
for (size_t i = 2; i < N; i++) sieve[i] = true;
for (size_t i = 2; i < N; i++) {
if (sieve[i])
for (size_t j = i*i; j < N; j += i) sieve[j] = false;
@mpoullet
mpoullet / AnagramSorter.cs
Created February 2, 2018 13:25 — forked from PaulWild/AnagramSorter.cs
Prime Number anagram sorter
static class Program
{
static void Main(string[] args)
{
var groupedWords = new Dictionary<double, List<string>>();
string line;
using (var reader = new StreamReader("words_alpha.txt"))
{
while ((line = reader.ReadLine()) != null)
@mpoullet
mpoullet / .vimrc
Created April 3, 2018 11:54 — forked from algermissen/.vimrc
My vimrc focussing on Rust development
" HOW TO DO 90% OF WHAT PLUGINS DO (WITH JUST VIM)
" Max Cantor
" NYC Vim Meetup -- August 3, 2016
@mpoullet
mpoullet / preprocessor_fun.h
Created April 3, 2018 13:44 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,