Skip to content

Instantly share code, notes, and snippets.

View odeblic's full-sized avatar

Olivier de BLIC odeblic

View GitHub Profile
@odeblic
odeblic / exceptions.cpp
Last active August 2, 2018 13:03
Simultaneous exceptions
#include <iostream>
#include <exception>
struct bar
{
~bar()
{
std::cout << std::uncaught_exceptions() << " uncaught exceptions (bar 1)\n";
try
@odeblic
odeblic / hash_pair.cpp
Last active May 6, 2020 13:58
Add the missing hash function for pairs in the standard.
#include <string>
#include <unordered_map>
namespace std {
template <typename F, typename S>
struct hash<std::pair<F, S>>
{
std::size_t operator()(std::pair<F, S> const &p) const
{
@odeblic
odeblic / smart_dtor.cpp
Last active October 7, 2018 21:10
Smart destructor
#include <iostream>
#include <memory>
struct Base
{
~Base()
{
std::cout << "~Base()" << std::endl;
}
};
import hashlib
import os
from PIL import Image
import struct
class Synanceia(object):
def __init__(self, original_image_file=None, modified_image_file=None):
self.__image_file = modified_image_file
if original_image_file is None:
#include <readline/history.h>
#include <readline/readline.h>
#include <iostream>
#include <vector>
std::vector<std::string> commandList =
{
"start",
"status",
"stop",