Skip to content

Instantly share code, notes, and snippets.

@stevedoyle
Last active October 10, 2018 16:08
Show Gist options
  • Save stevedoyle/b65a3bfb38fffeacad8b2ebe6b19d34e to your computer and use it in GitHub Desktop.
Save stevedoyle/b65a3bfb38fffeacad8b2ebe6b19d34e to your computer and use it in GitHub Desktop.
Misc utilities to simplify common tasks in an iPython shell
def mpps(gbps, size):
return (gbps / (size * 8)) * 1000
def gbps(mpps, size):
return mpps * size * 8 / 1000;
def pkt_size(gbps, mpps):
return (gbps * 1000) / mpps / 8
##################################################
def cyclespp(freq_mhz, mpps):
return freq_mhz / mpps
##################################################
import decimal
def eng(x):
return decimal.Decimal(x).normalize().to_eng_string()
def sep(x):
return "{:,}".format(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment