Skip to content

Instantly share code, notes, and snippets.

@metcalfc
Last active August 27, 2020 03:13
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 metcalfc/a7a2265325613ad11a09b3437a9fef0a to your computer and use it in GitHub Desktop.
Save metcalfc/a7a2265325613ad11a09b3437a9fef0a to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import math
image_sizes = [10, 100, 250, 500, 1000]
pull_counts = [10, 100, 1000, 10000, 100000, 1000000]
free_bw = 10 * 1024
cost_gb = 0.5
print(",pull count,,,,,,")
print("size (mb),", end="")
for i in pull_counts:
print(i, end=",")
print()
for size in image_sizes:
cost = 0
print(size, end=",")
for count in pull_counts:
mb_used = (size * count) - free_bw
if mb_used > 0:
cost = math.ceil(mb_used / 1024) * cost_gb
print("${:.2f}".format(cost), end=",")
print()
pull count
size (mb) 10 100 1000 10000 100000 1000000
10 $0.00 $0.00 $0.00 $44.00 $483.50 $4878.00
100 $0.00 $0.00 $44.00 $483.50 $4878.00 $48823.50
250 $0.00 $7.50 $117.50 $1216.00 $12202.50 $122065.50
500 $0.00 $19.50 $239.50 $2436.50 $24409.50 $244136.00
1000 $0.00 $44.00 $483.50 $4878.00 $48823.50 $488276.50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment