Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How many times have you found yourself doing the same thing? Converting units without a standard library? Why don't we have something for that? My answer: https://github.com/tbielawa/bitmath now we do.
def frob_account_quota(user):
user_quota_bytes = user.quota
user_quota_human_readable = user_quota_bytes / (1024 * 1024 * 1024)
print "%s has a quota of %s GB" % (user.name, user_quota_human_readable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.