Skip to content

Instantly share code, notes, and snippets.

@tbielawa
Created March 16, 2014 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbielawa/9590427 to your computer and use it in GitHub Desktop.
Save tbielawa/9590427 to your computer and use it in GitHub Desktop.
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