Skip to content

Instantly share code, notes, and snippets.

@metcalfc

metcalfc/price.py

Last active Aug 27, 2020
Embed
What would you like to do?
#!/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
You can’t perform that action at this time.