ungleich-tools/generate-coupon.py

17 lines
380 B
Python
Raw Normal View History

2021-12-14 15:01:23 +00:00
#!/usr/bin/env python3
import random
import ipaddress
2021-12-14 15:15:44 +00:00
import datetime
2021-12-14 15:01:23 +00:00
net = ipaddress.IPv6Network("2a0a:e5c0:11:2::/64")
offset = random.randint(0, 2**64)
coupon = net[offset]
2021-12-14 15:15:44 +00:00
today = datetime.datetime.now()
today_in_2y = today + datetime.timedelta(days=365*2)
print(f"Coupon ID : {coupon}")
print(f"Today : {today}")
print(f"Today in 2 years: {today_in_2y}")