This commit is contained in:
Jeffrey Paul 2019-10-18 23:22:53 -07:00
commit b919d5b437
12 changed files with 795 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
__pycache__
*.pyc
*.pyo

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM python:3
ADD . /app
WORKDIR /app
ENV PYTHONPATH /app
ENV PORT 80
CMD [ "python3", "/app/bin/server" ]
EXPOSE 80

1
LICENSE Normal file
View File

@ -0,0 +1 @@
This code is released into the public domain.

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
default: codename
codename:
@PYTHONPATH=. python3 bin/codename
build:
docker build -t sneak/codenamegenerator .

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# generate-codename
This software generates random codenames for projects.
# See Also
[docker
names-generator](https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go)
# Author
Jeffrey Paul <sneak@sneak.berlin>
https://sneak.berlin
[@sneakdotberlin](https://twitter.com/sneakdotberlin)
`5539 AD00 DE4C 42F3 AFE1 1575 0524 43F4 DF2A 55C2`
# License
This code is released into the public domain.

9
bin/codename Normal file
View File

@ -0,0 +1,9 @@
#!/usr/bin/python
from codenamegenerator import generate_codename
def main():
print(generate_codename(snake_case=False))
if __name__ == "__main__":
main()

9
bin/server Normal file
View File

@ -0,0 +1,9 @@
#!/usr/bin/python
from codenamegenerator import run_server
def main():
run_server()
if __name__ == "__main__":
main()

View File

@ -0,0 +1 @@
from .generate import generate_codename, run_server

131
codenamegenerator/first.txt Normal file
View File

@ -0,0 +1,131 @@
adoring
affectionate
agitated
amazing
angry
aqua
aquamarine
awesome
azure
beautiful
beige
black
blissful
blue
bold
boring
brave
brown
busy
charming
chartreuse
chocolate
clever
competent
confident
cool
coral
cornflower
crazy
crimson
cyan
dazzling
determined
distracted
dreamy
eager
elastic
elated
elegant
eloquent
epic
exciting
fervent
festive
focused
friendly
frosty
fuchsia
funny
gallant
gifted
gold
goofy
gracious
gray
great
green
grey
happy
hopeful
hot pink
hungry
indigo
ivory
jolly
keen
khaki
kind
laughing
lavender
lime
linen
loving
lucid
magenta
magical
maroon
modest
musing
naughty
navy
nervous
nice
nifty
nostalgic
objective
olive
optimistic
orangered
orchid
peaceful
pensive
pink
plum
practical
priceless
purple
quirky
quizzical
red
relaxed
romantic
sad
salmon
serene
sharp
sienna
silly
silver
sleepy
snow
stoic
strange
sweet
tan
teal
tender
thirsty
trusting
turquoise
upbeat
vibrant
vigilant
vigorous
violet
wheat
white
wonderful
yellow
youthful
zealous

View File

@ -0,0 +1,55 @@
#!/usr/bin/env python
#234567891123456789212345678931234567894123456789512345678961234567897123456789
# encoding: utf-8
import http.server
import json
import os
import random
import socketserver
this_dir_path = os.path.dirname(os.path.realpath(__file__))
FIRST = []
with open(os.path.join(this_dir_path, "first.txt"), 'r') as fp:
FIRST = [ x.strip() for x in fp.readlines() ]
SECOND = []
with open(os.path.join(this_dir_path, "second.txt"), 'r') as fp:
SECOND = [ x.strip() for x in fp.readlines() ]
def rand_firstword():
return(random.choice(FIRST))
def rand_secondword():
return(random.choice(SECOND))
def generate_codename(snake_case=False):
sep = " "
if snake_case:
sep = "_"
return(rand_firstword() + sep + rand_secondword())
def clientry():
print(generate_codename())
class CodenameHandler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-Type',
'application/json; charset=utf-8')
self.end_headers()
self.wfile.write(
json.dumps(
{ 'codename': generate_codename() }
).encode('utf-8')
)
def run_server():
PORT = int(os.environ.get('PORT',8080))
with socketserver.TCPServer(("", PORT), CodenameHandler) as httpd:
print("serving codenames at port", PORT)
httpd.serve_forever()

View File

@ -0,0 +1,527 @@
aardvark
aircraft
airport
albatross
alligator
alpaca
angle
ankle
ant
anteater
antelope
antler
ape
apple
arch
arm
armadillo
army
arrow
baboon
baby
badger
bag
ball
balloon
band
barracuda
basin
basket
bat
bath
bean
bear
beaver
bed
bee
bell
belt
berry
bill
bird
bison
blade
boar
board
boat
bone
book
bookcase
bookstore
boot
bottle
bow
box
boy
brain
brake
branch
bread
brick
bridge
brush
bucket
buckle
buffalo
bulb
butterfly
button
cabin
cabinet
cafe
cake
camel
camera
candy
cane
canoe
cap
capybara
car
card
caribou
carpet
carriage
cart
castle
cat
cave
cello
chain
chair
cheese
cheetah
chest
chicken
child
chimpanzee
chin
chinchilla
church
cinema
circle
clam
clock
cloud
coat
cobra
cod
collar
comb
computer
cord
costume
couch
cow
coyote
crab
crane
crest
crocodile
crow
cup
curtain
cushion
deer
desk
dinosaur
dog
dolphin
donkey
door
dove
dragonfly
drain
drawer
dress
dresser
drop
drum
duck
eagle
ear
earring
echidna
eel
egg
elephant
elk
emu
engine
eye
face
factory
falcon
fan
farm
feather
ferret
film
finch
finger
fish
flag
flamingo
floor
flower
fly
foot
forest
fork
fowl
fox
frame
freezer
frock
frog
fruit
galaxy
garage
garden
garlic
gazelle
gerbil
gift
giraffe
girl
glasses
glove
gloves
goat
goldfish
goose
gorilla
gown
grasshopper
guest
guinea pig
guitar
gull
gun
hair
hammer
hamster
hand
hare
hat
hawk
head
heart
hedgehog
heels
hen
heron
herring
hippopotamus
hook
horn
horse
hospital
host
hotel
house
human
hyena
ibex
island
jacket
jaguar
jaw
jellyfish
jersey
jewel
kangaroo
kettle
key
keyboard
knee
knife
knot
koala
kookabura
lamb
lamp
lark
leaf
leg
lemon
lemur
leopard
library
line
lion
lip
lips
llama
lobster
lock
loris
luggage
mall
mallard
manatee
mango
mantis
map
market
marten
match
medicine
meerkat
mink
mirror
mole
mongoose
monkey
moon
moonlight
moose
mosquito
mouse
mouth
mule
muscle
museum
music
nail
narwhal
neck
necklace
needle
nerve
net
newt
noise
noodle
nose
notebook
nut
ocean
octopus
office
oil
onion
opossum
orange
oryx
ostrich
otter
oven
owl
ox
oyster
pad
pagoda
palm
pancake
panda
panther
pants
paper
parcel
park
parrot
partridge
pasta
peacock
pelican
pen
pencil
penguin
pharmacy
pheasant
phone
piano
picture
pig
pigeon
pin
pipe
plane
plant
plate
plough
pocket
pony
popcorn
porcupine
porpoise
pot
potato
pouch
prison
pump
pumpkin
purse
pyramid
quail
rabbit
raccoon
radio
rail
rainbow
ram
rat
raven
razor
receipt
reindeer
restaurant
rhinoceros
rice
ring
road
rod
roof
root
sail
salamander
salmon
salt
sand
sandal
sandals
sandwich
sardine
sari
saxophone
scale
school
scissors
scorpion
screw
sea lion
sea urchin
seahorse
seal
seed
shark
sheep
shelf
ship
shirt
shoe
shorts
shoulder
shrew
shrimp
sink
skin
skirt
skunk
sky
skyscraper
slipper
slippers
smile
snail
snake
snowman
soap
sock
socks
sofa
soup
spade
spaghetti
sparrow
spider
sponge
spoon
spring
square
squid
squirrel
stadium
stamp
star
starling
station
stem
stick
stingray
stocking
stomach
store
stork
stove
strawberry
street
suit
suitcase
sun
sunglasses
swallow
swan
sweater
table
tablet
tail
tapir
taxi
tea
telephone
television
theater
thread
throat
thumb
ticket
tie
tiger
tissue
toad
toe
tomato
tongue
tooth
town
toy
train
tray
tree
trousers
trout
truck
tunnel
turkey
turtle
umbra
umbrella
uncle
underwear
vase
vehicle
vest
villa
village
violin
voice
waist
wall
wallaby
wallet
walrus
watch
water
water buffalo
watermelon
whale
wheel
whip
whisker
whistle
window
wing
wings
wire
wolf
wolverine
wombat
worm
wren
wrist
xylophone
yak
zebra
zoo

18
setup.py Normal file
View File

@ -0,0 +1,18 @@
from setuptools import setup
setup(
name='codenamegenerator',
version='1.0.0',
author='Jeffrey Paul',
author_email='sneak@sneak.berlin',
packages=['codenamegenerator'],
url='https://github.com/sneak/codenamegenerator/',
license='Public Domain',
description='Generates codenames',
install_requires=[],
entry_points={
'console_scripts': [
'generate-codename=generatecodename:clientry'
]
},
)