Skip to content

Instantly share code, notes, and snippets.

View ttamg's full-sized avatar

Matt G ttamg

  • London
View GitHub Profile
@radzhome
radzhome / json_schema_to_django_model.py
Last active August 5, 2023 00:46
Converts json schema to django models.py
"""
Json Schema to Django Model
"""
import json
import argparse
import logging
import os
def determine_model_name(model_id=None, filename=None):
@mminer
mminer / cachedecorator.py
Created January 12, 2015 23:57
An example of a Python decorator to simplify caching a function's result.
"""An example of a cache decorator."""
import json
from functools import wraps
from redis import StrictRedis
redis = StrictRedis()
def cached(func):
@ikuyamada
ikuyamada / mongo_cache.py
Last active September 21, 2023 12:01
A Python decorator that caches the result of a function on MongoDB
# -*- coding: utf-8 -*-
import base64
import cPickle as pickle
import hashlib
from functools import wraps
class NoopSerializer(object):
def serialize(self, obj):