Skip to content

Instantly share code, notes, and snippets.

View brifordwylie's full-sized avatar
:octocat:

Brian Wylie brifordwylie

:octocat:
View GitHub Profile
@mashiro
mashiro / message.hpp
Last active June 15, 2023 09:54
zeromq + msgpack
#include <string>
#include <ctime>
#include <msgpack.hpp>
struct message
{
std::string tag;
std::time_t time;
std::string text;
MSGPACK_DEFINE(tag, time, text);
@FZambia
FZambia / procache.py
Last active April 27, 2019 16:06
python in process memory cache based on ordered dictionary - with size limit and timeout support
# coding: utf-8
import time
from collections import OrderedDict
class Cache():
"""
In process memory cache. Not thread safe.
Usage:
@daragh
daragh / module_mocking.py
Created September 10, 2012 15:45
Example code for mocking a module in Python
'''
Example code to show how it is possible to mock an entire module by patching
the sys.modules dict using mock ( http://www.voidspace.org.uk/python/mock/ ).
'''
from mock import patch, MagicMock
def test_import_patching():
module_mock = MagicMock()
with patch.dict('sys.modules', **{