Skip to content

Instantly share code, notes, and snippets.

@tym-xqo
Last active October 5, 2015 12:14
Show Gist options
  • Save tym-xqo/857b679e83f5dcd84577 to your computer and use it in GitHub Desktop.
Save tym-xqo/857b679e83f5dcd84577 to your computer and use it in GitHub Desktop.
arbitrary two-word name generator
#!/usr/bin/env python3
#coding: utf-8
import random
from AppKit import NSPasteboard, NSArray
def namer():
adjectives = ("aliased",
"angelic",
"anonymous",
"anti",
"automatic",
"bad",
"bankrupt",
"barefoot",
"basic",
"beautiful",
"better",
"big",
"bitter",
"black",
"blank",
"blue",
"bold",
"bratty",
"brief",
"brutal",
"burning",
"caustic",
"cheap",
"circular",
"dancing",
"dark",
"deadly",
"dry",
"ecstatic",
"effulgent",
"electric",
"fabulous",
"fancy",
"fast",
"fizzy",
"folk",
"fuzzy",
"ghost",
"giant",
"glowing",
"greasy",
"green",
"grey",
"happy",
"hilarious",
"hip",
"hot",
"human",
"indie",
"industrial",
"iron",
"jealous",
"joking",
"latex",
"limp",
"logical",
"loose",
"loving",
"loud",
"lumpy",
"mad",
"magical",
"major",
"manic",
"meta",
"metallic",
"mindless",
"minor",
"naked",
"national",
"nebulous",
"negative",
"neon",
"new",
"numb",
"oblique",
"oily",
"oscillating",
"outer",
"pink",
"plastic",
"polar",
"pop",
"punk",
"purple",
"quick",
"raw",
"regular",
"real",
"residual",
"sad",
"sarcastic",
"scary",
"schizoid",
"scrambled",
"sexy",
"shaved",
"shining",
"silent",
"silly",
"silver",
"slimy",
"sloppy",
"smart",
"sonic",
"space",
"special",
"stark",
"stiff",
"still",
"strange",
"sub",
"steel",
"strong",
"super",
"sweet",
"teenage",
"thump",
"total",
"toxic",
"tragic",
"tricky",
"tropical",
"union",
"untold",
"useless",
"vampire",
"velvet",
"violet",
"voodoo",
"wet",
"white",
"whomping",
"x-ray",
"yellow",
"young",
"zombie"
)
nouns = ("airplane",
"alias",
"angel",
"anthem",
"apple",
"argument",
"art",
"bat",
"bear",
"beast",
"bike",
"bicycle",
"bleach",
"book",
"boot",
"bowl",
"boy",
"brain",
"brat",
"brute",
"building",
"carpet",
"cat",
"chain",
"cheese",
"city",
"color",
"damage",
"death",
"disease",
"dog",
"doll",
"dolphin",
"drum",
"egret",
"embrace",
"ethic",
"face",
"ferret",
"field",
"finger",
"fire",
"fish",
"flag",
"flower",
"force",
"fox",
"fruit",
"garage",
"genius",
"ghost",
"giant",
"girl",
"hammer",
"head",
"heart",
"holiday",
"house",
"human",
"iron",
"jackknife",
"joke",
"king",
"lamb",
"laughter",
"law",
"life",
"lion",
"lip",
"lock",
"loop",
"map",
"metal",
"monkey",
"nation",
"neck",
"orb",
"orbit",
"order",
"otter",
"paint",
"panda",
"peace",
"plastic",
"poem",
"point",
"pole",
"power",
"prince",
"princess",
"pulley",
"punk",
"quail",
"queen",
"quiz",
"rat",
"robot",
"rocket",
"saw",
"shark",
"ship",
"sister",
"skateboard",
"skull",
"sky",
"slime",
"space",
"squirrel",
"steel",
"summer",
"sweat",
"teen",
"television",
"theory",
"thing",
"thorax",
"toe",
"tool",
"torso",
"tree",
"turkey",
"uncle",
"union",
"vampire",
"vegetable",
"wall",
"water",
"wave",
"winter",
"wolverine",
"x",
"yard",
"youth",
"zebra",
"zero",
"zombie"
)
adj = random.choice(adjectives)
nom = random.choice(nouns)
dig = ''.join(["%s" % random.randint(0, 9) for num in range(0, 2)])
name = '-'.join((adj, nom, dig))
return(name)
def copy_to_clipboard(a='foo'):
pb = NSPasteboard.generalPasteboard()
pb.clearContents()
a = NSArray.arrayWithObject_(a)
pb.writeObjects_(a)
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-p', action='store_true')
args = parser.parse_args()
name = namer()
if args.p:
print(name)
else:
copy_to_clipboard(name)
print('%s copied to clipboard' % name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment