Skip to content

Instantly share code, notes, and snippets.

@mcs07
mcs07 / customwriter.cpp
Last active August 10, 2016 10:53
A custom writer class for JsonCpp that allows more control over the output formatting of the JSON. Allows custom indenting, custom line wrap width, and custom whitespace around brackets, colons and commas.
/**********************************************************************
Copyright (c) 2013 by Matt Swain <[email protected]>
The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@mcs07
mcs07 / backup_db.py
Last active August 14, 2019 20:50
Simple versioned backups for MongoDB
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Save versioned backups of collections in MongoDB. Quick and dirty. """
import datetime
import shutil
import os
import subprocess
import zipfile