Skip to content

Instantly share code, notes, and snippets.

Mathieu Stefani oktal

Block or report user

Report or block oktal

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
View bot.py
# coding=utf-8
import discord
import logging
import aiohttp
CO2_API = 'http://www.hqcasanova.com/co2/'
IPCC_REPORTS = {
'ar5': {
'wg1': {
@oktal
oktal / nanomsg_multipart.cc
Last active Aug 29, 2015
Multipart messaging protocol with nanomsg
View nanomsg_multipart.cc
#include <nanomsg/nn.h>
#include <nanomsg/reqrep.h>
#include <string>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <vector>
#include <memory>
#include <limits>
@oktal
oktal / limbes.cc
Last active Aug 29, 2015
Devils never cry
View limbes.cc
#include <iostream>
#include <vector>
#include <stdexcept>
#include <cassert>
#include <limits>
#include <algorithm>
class Cell {
public:
friend class Angel;
@oktal
oktal / list.c
Created Jun 16, 2014
Linked list implementation in C
View list.c
#include "list.h"
#include <stdlib.h>
static bool list_empty(struct list *this)
{
return this == NULL ? TRUE :
this->m_size == 0 ? TRUE : FALSE;
}
@oktal
oktal / optional.h
Last active Aug 29, 2015
Option type in C++11
View optional.h
#ifndef OPTION_H
#define OPTION_H
#include <cstdlib>
#include <cstring>
#include <utility>
#include <iostream>
#include <tuple>
#include <functional>
@oktal
oktal / string.c
Last active Dec 23, 2015
String manipulation in C
View string.c
#include "string.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h> /* DEBUG */
static string_err string_enlarge(String *this, size_t add)
{
string_err err = STRING_ERR_OK;
@oktal
oktal / sitemap_crawl.cc
Created Aug 25, 2013
A simple XML sitemap crawler using C++ Poco Libraries.
View sitemap_crawl.cc
#include "Poco/DOM/DOMParser.h"
#include "Poco/DOM/Document.h"
#include "Poco/DOM/AutoPtr.h"
#include "Poco/SAX/InputSource.h"
#include "Poco/Net/HTTPClientSession.h"
#include "Poco/Net/HTTPRequest.h"
#include "Poco/Net/HTTPResponse.h"
#include "Poco/Net/DNS.h"
#include "Poco/DOM/ElementsByTagNameList.h"
#include <set>
@oktal
oktal / article-cpp-vartemplates.md
Created May 20, 2013
Article sur les variadic templates pour le laboratoire SL3
View article-cpp-vartemplates.md

Title: Jouons avec C++11: métaprogrammation et variadic templates Date: 2013-05-19 12:26:00 Tags: c++, c++11, templates, variadic templates, metaprogrammation Author: Mathieu Stefani

Aujourd'hui nous allons nous détendre avec un peu de C++, mais pas n'importe quel C++ ! Nous allons faire du C++11 et nous allons explorer ensemble une fonctionnalité très intéressante et aux nombreuses possibilités du langage : les variadic templates.

@oktal
oktal / compile-time-crc32.cc
Created May 14, 2013
Compile-time C++ CRC32
View compile-time-crc32.cc
constexpr unsigned int crc32_table[] = {
0, 0x77073096, 0xEE0E612C, 0x990951BA,
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
@oktal
oktal / binary-converter.cc
Created May 13, 2013
Safe compile-time binary converter
View binary-converter.cc
#include <iostream>
#include <type_traits>
#include <cassert>
namespace details {
template<typename T> struct DigitValue {
};
template<> struct DigitValue<int> {
static constexpr int v(const int value) { return value; }
You can’t perform that action at this time.