Skip to content

Instantly share code, notes, and snippets.

View ahamez's full-sized avatar
🦉

Alexandre Hamez ahamez

🦉
View GitHub Profile
@ahamez
ahamez / bench_hash_table.cc
Created August 30, 2014 13:40
sdd::mem::hash_table comparison with boost::intrusive::unordered_set and std::unordered_set
#include <chrono>
#include <iostream>
#include <memory>
#include <unordered_set>
#include <vector>
#include <boost/intrusive/unordered_set.hpp>
#include <sdd/mem/hash_table.hh>
#include <sdd/util/hash.hh>
@ahamez
ahamez / variant_eggs.cc
Last active August 29, 2015 14:06
Compare sdd::mem::variant and eggs::variant (https://github.com/eggs-cpp/variant)
#include <chrono>
#include <iostream>
#include <type_traits>
#include <eggs/variant.hpp>
/* -------------------------------------------------------------------------------- */
class timer
{
private:
@ahamez
ahamez / expression_templates.cc
Last active August 29, 2015 14:10
expression templates
#include <algorithm>
#include <functional>
#include <iterator>
// #include <iostream>
#include <initializer_list>
#include <vector>
/* ---------------------------------------------------------------------------------------------- */
template <typename T, typename Exp>
@ahamez
ahamez / flightradar24.py
Last active May 15, 2020 20:03
Read data from flightradar24
#! /usr/bin/env python
import json
import time
import shelve
import urllib
import urllib.request
DB = 'flights'
API = "http://www.flightradar24.com/zones/full_all.json"
@ahamez
ahamez / CMakeLists.txt
Created November 1, 2015 17:33
CMake configuration to compile paho
cmake_minimum_required (VERSION 2.8.9)
project(paho)
find_package(OpenSSL)
find_package(Threads)
set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR})
@ahamez
ahamez / display_sleep.cc
Created November 1, 2015 20:26
Programmatically put display to sleep
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
// clang++ -framework CoreFoundation -framework IOKIT display_sleep.cc
int
main()
{
const io_registry_entry_t r =
IORegistryEntryFromPath( kIOMasterPortDefault
@ahamez
ahamez / dd.cc
Created December 19, 2015 11:05
A dummy Decision Diagram with reference counting using shared_ptr and weak_ptr
#include <cassert>
#include <map>
#include <memory> // shared_ptr, weak_ptr
#include <unordered_map>
#include <utility> // pair
/*----------------------------------------------------------------------------*/
class Node
{
@ahamez
ahamez / simple-fsm.cc
Created December 20, 2015 07:21
Idea for simple FSM interface
struct s0
{
template <typename SM>
void
on_entry(SM&)
const
{}
template <typename SM>
void
@ahamez
ahamez / msm.cc
Created January 7, 2016 16:46
Some Boost.MSM usages
#include <iostream>
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/state_machine_def.hpp>
#include <boost/msm/front/functor_row.hpp>
namespace msm = boost::msm;
namespace mpl = boost::mpl;
using namespace msm::front;
@ahamez
ahamez / algorithms.ex
Last active November 25, 2016 07:03
Some algorithms for insertion into sorted lists
defmodule Algorithms do
@doc ~S"""
Insert `elt` into the already sorted `list`.
iex> Algorithms.insert_sort(1, [])
[1]
iex> Algorithms.insert_sort(1, [2,3])
[1,2,3]