Skip to content

Instantly share code, notes, and snippets.

@reverendpaco
Created July 24, 2017 18:54
Show Gist options
  • Save reverendpaco/dc919b31f9b7a50f1bb98ffe4da2303c to your computer and use it in GitHub Desktop.
Save reverendpaco/dc919b31f9b7a50f1bb98ffe4da2303c to your computer and use it in GitHub Desktop.
import math
def vpcnum(n):
Y,X = math.modf( (n-1)/float(16) )
x = "10.{0}.{1}.0".format(int(X),int(Y*256))
return x
def client(n):
clientNum = (n*2 + 16)
return (vpcnum(clientNum-1),vpcnum(clientNum))
print [ (x,client(x)) for x in range(1,2041)]
import csv
with open("clients.csv", "wb") as csv_file:
writer = csv.writer(csv_file, delimiter=',')
data = [ (x,client(x)) for x in range(1,2041) ]
for clientnum, (vpc1, vpc2) in data:
writer.writerow((clientnum,vpc1+"/20",vpc2+"/20"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment