Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
""" Generate lovely ideas for hack day talks """
import random
import re
productions = {
'tech': [
'other': [
'person': [
# pp = preposition phrase
'pp': [
'in 140 characters',
'in small pieces',
'on a Raspberry Pi',
'for great justice',
'talk': [
'${tech} for ${person}',
'${tech} + ${tech} = awesome',
'${tech} with ${other}',
'${tech} and ${other}',
'${tech} ${pp}',
'How to use ${tech} to make an amazing mess',
def randomly_generated(nt):
template = random.choice(productions[nt])
def replace(match):
return randomly_generated(
return re.sub(r'\$\{(\w+)\}', replace, template)
def random_idea():
return randomly_generated('talk')

well done! super cool script. gonna fork it!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment