Skip to content

Instantly share code, notes, and snippets.

View mcptr's full-sized avatar

mcptr mcptr

  • metaceptron
View GitHub Profile
@mcptr
mcptr / gist:74c39aa6ae3504e5cdaa29d3f9cf2f2b
Last active May 29, 2018 09:12
mongodb: convert dict to dotted notation (python)
# https://stackoverflow.com/questions/50578581/pymongo-dict-to-dotted-notation-automatically
# Converts a dict/iterable object (instance of Meta) to a dotted notation.
# Supports objects of classes defined with namedtuple (_asdict()).
# Doesn't process array elements.
# Instances of Meta can implement __call__().
class Meta:
def __setitem__(self, k, v):
self.__dict__[k] = v
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <cstring>
#include <iostream>
#include <stdint.h>