Skip to content

Instantly share code, notes, and snippets.

bosswissam

  • 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
View server.py
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):
View keybase.md

Keybase proof

I hereby claim:

  • I am bosswissam on github.
  • I am bosswissam (https://keybase.io/bosswissam) on keybase.
  • I have a public key ASBFsCO1ewPVUnKwET9gTU_LVnga1Gj-3eIvzPZOpd9D-go

To claim this, I am signing this object:

View pysize.py
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
bosswissam / get_size.py
Created Feb 3, 2016
Get the true size of an object in memory
View get_size.py
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.