Skip to content

Instantly share code, notes, and snippets.

@gremax
Created April 13, 2023 13:37
Show Gist options
  • Save gremax/051e79c32ffe789278d30be9c32c0774 to your computer and use it in GitHub Desktop.
Save gremax/051e79c32ffe789278d30be9c32c0774 to your computer and use it in GitHub Desktop.
import json
import random
from datetime import datetime, timedelta, timezone
def random_date_in_past_months(months):
now = datetime.now()
start_date = now - timedelta(days=months * 30)
random_days = random.randint(0, months * 30)
random_date = start_date + timedelta(days=random_days)
random_timezone = timezone(timedelta(minutes=random.randint(-720, 720)))
return random_date.replace(tzinfo=random_timezone).isoformat()
def random_course_name():
courses = [
"Interdimensional Cable Theory",
"Pickle Rick Physics",
"The Science of Mr. Meeseeks",
"The Citadel of Ricks: A Sociopolitical Analysis",
"Understanding Birdperson's Language",
"Schwifty Songwriting 101",
"The Multiverse: A Guide to Infinite Realities",
"Time Travel Paradoxes in Rick and Morty",
"Evolution of the Galactic Federation",
"Squanchy Linguistics",
"Anatomy of a Plumbus",
"Curse Purge Plus: A Study of Cursed Objects",
"Gazorpazorp Culture and Society",
"The Ethics of Rick Sanchez",
"The Morty Mind Blowers: Memory Manipulation",
"Snuffles and the Canine Uprising",
"Microverse Technology: A Sustainable Energy Source",
"Cronenberg Universe: A Biological Catastrophe",
"The Purge Planet: An Anthropological Analysis",
"Morty's Mind Blowers: A Psychological Perspective",
"Szechuan Sauce: A Culinary History",
"The Science of Abradolf Lincler",
"Gromflomites: Biology and Behavior",
"Get Schwifty: A Guide to Rick's Dance Moves",
"The Science Behind the Portal Gun",
"The Anatomy of a Meeseeks Box",
"The Vindicators: Superhero Team Dynamics",
"Froopyland Ecology and Ecosystems",
"The Art of Intergalactic Diplomacy",
"The Philosophy of Noob-Noob",
"Anatomy of a Fart",
"The Rickshank Rickdemption: A Tale of Betrayal",
"Planets and Civilizations of the Rick and Morty Universe",
"Rick's Inventions: A Technological Exploration",
"Krombopulos Michael: A Case Study in Assassination",
"Evil Morty: A Character Analysis",
"Understanding the Unity Hive Mind",
"The Interdimensional Council of Ricks",
"The Ethics of Cloning in the Rick and Morty Universe",
"Sleepy Gary: A Study in False Memories",
"Total Rickall: A Guide to Parasitic Aliens",
"Fart's Musical Language",
"The Life and Times of Slow Mobius",
"The Science of Rick Potion #9",
"A Guide to the Multiverse's Deadliest Assassins",
"Anatomy of a Butter Robot",
"The Galactic Federation: Politics and History",
"King Jellybean: A Case Study in Monstrous Villains",
"The Science of Operation Phoenix",
"Gazorpazorpfield: A Study in Alien Entertainment"
]
return random.choice(courses)
def generate_json_collection():
collection = []
for _ in range(130):
template_type = random.choice(["event", "order", "course"])
if template_type == "event":
collection.append({
"name": f"Virtual event #{random.randint(1, 1000)}",
"template": random.choice(["Event Registration", "Event Reminder"]),
"status": random.choice([0, 1, 2]),
"delivery_time": random_date_in_past_months(2),
"deliveries_count": random.randint(100, 2000),
})
elif template_type == "order":
collection.append({
"name": f"Order #{random.randint(1, 1000)}",
"template": random.choice(["Order Confirmation", "Manual Order"]),
"status": random.choice([0, 1, 2]),
"delivery_time": random_date_in_past_months(2),
"deliveries_count": 1,
})
else:
collection.append({
"name": random_course_name(),
"template": random.choice(["Purchase Expiration", "Certificate Issued"]),
"status": random.choice([0, 1, 2]),
"delivery_time": random_date_in_past_months(3),
"deliveries_count": 1,
})
return collection
if __name__ == "__main__":
json_collection = generate_json_collection()
print(json.dumps(json_collection, indent=2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment