Created
March 16, 2014 21:53
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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