Skip to content

Instantly share code, notes, and snippets.


  • San Francisco
Block or report user

Report or block bosswissam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import json
import tornado.ioloop
import tornado.web
DB = dict()
class BaseHandler(tornado.web.RequestHandler):
def validate_input(self):
if not isinstance(self.json_args.get('key'), str):

Keybase proof

I hereby claim:

  • I am bosswissam on github.
  • I am bosswissam ( on keybase.
  • I have a public key ASBFsCO1ewPVUnKwET9gTU_LVnga1Gj-3eIvzPZOpd9D-go

To claim this, I am signing this object:

import sys
def get_size(obj, seen=None):
"""Recursively finds size of objects"""
size = sys.getsizeof(obj)
if seen is None:
seen = set()
obj_id = id(obj)
if obj_id in seen:
return 0
bosswissam /
Created Feb 3, 2016
Get the true size of an object in memory
import sys
def get_size(obj):
size = 0
if isinstance(obj, dict):
size+= sum([get_size(v) for v in obj.values()])
size+= sum([get_size(k) for k in obj.keys()])
elif hasattr(obj, '__dict__'):
size+= get_size(obj.__dict__)
elif hasattr(obj, '__iter__'):
You can’t perform that action at this time.