Skip to content

Instantly share code, notes, and snippets.

@joshland
Created January 15, 2017 23:09
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 joshland/4058c6320db0cf966af2f7e0edd6e5e1 to your computer and use it in GitHub Desktop.
Save joshland/4058c6320db0cf966af2f7e0edd6e5e1 to your computer and use it in GitHub Desktop.
DoS your computer, using only Python
def convertSize(size):
'''
reduce xxxK, xxxM, xxxG, etc
'''
if size.strip() == "":
size = 0
elif size[-1] == 'K':
size = size*1024
elif size[-1] == 'M':
size = size*1024*1024
elif size[-1] == 'G':
size = size*1024*1024*1024
elif size[-1] == 'T':
size = size*1024*1024*1024*1024
pass
return size
if __name__ == "__main__":
convertSize("500G")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment