deacon 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +625 -0
- data/README.md +131 -0
- data/Rakefile +17 -0
- data/data/gfnames.txt +256 -0
- data/data/gmnames.txt +256 -0
- data/data/srnames.txt +65536 -0
- data/lib/deacon.rb +7 -0
- data/lib/deacon/generator.rb +37 -0
- data/lib/deacon/mac_generator.rb +17 -0
- data/lib/deacon/random_generator.rb +42 -0
- data/lib/deacon/version.rb +3 -0
- data/test/test_helper.rb +2 -0
- data/test/unit/mac_generator_test.rb +33 -0
- data/test/unit/random_generator_test.rb +121 -0
- metadata +77 -0
data/README.md
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# Deacon - human readable random name generator
|
2
|
+
|
3
|
+
Out of ideas for incoming bare-metal host names in your cluster? This little
|
4
|
+
gem is a way out! It contains frequently occurring given names and surnames
|
5
|
+
from the 1990 US Census (public domain data):
|
6
|
+
|
7
|
+
* 256 (8 bits) unique male given names
|
8
|
+
* 256 (8 bits) unique female given names
|
9
|
+
* 65,536 (16 bits) unique surnames
|
10
|
+
|
11
|
+
Given names were filtered to be 3-5 characters long, surnames 5-8 characters,
|
12
|
+
therefore generated names are never longer than 14 characters (5+1+8).
|
13
|
+
|
14
|
+
This gives 33,554,432 (25 bits) total of male and female name combinations.
|
15
|
+
Built-in generator can either generate randomized succession, or generate
|
16
|
+
combinations based on MAC adresses.
|
17
|
+
|
18
|
+
### Random generator
|
19
|
+
|
20
|
+
The random name generator makes use of [Fibonacci linear feedback shift
|
21
|
+
register](https://en.wikipedia.org/wiki/Linear_feedback_shift_register) which
|
22
|
+
gives deterministic sequence of pseudo-random numbers. Additionally, algorighm
|
23
|
+
makes sure names with same first name (or gender) and last name are not
|
24
|
+
returned in succession. Since there are about 1% of such cases, there are
|
25
|
+
about 33 million unique total names. During plugin installation, the register
|
26
|
+
is seeded with a random value, so each installation gets unique sequence.
|
27
|
+
Example sequence:
|
28
|
+
|
29
|
+
* velma-pratico.my.lan
|
30
|
+
* angie-warmbrod.my.lan
|
31
|
+
* grant-goodgine.my.lan
|
32
|
+
* alton-sieber.my.lan
|
33
|
+
* velma-vanbeek.my.lan
|
34
|
+
* don-otero.my.lan
|
35
|
+
* sam-hulan.my.lan
|
36
|
+
|
37
|
+
The polynomial used in linear feedback shift register is x^25 + x^24 + x^23 + x^22 + 1.
|
38
|
+
|
39
|
+
The key thing is to store register (a number) and use it for each generation
|
40
|
+
in order to get non-repeating sequence of name combinations.
|
41
|
+
|
42
|
+
### MAC generator
|
43
|
+
|
44
|
+
Examples of MAC-based names:
|
45
|
+
|
46
|
+
* 24:a4:3c:ec:76:06 -> bobby-louie-sancher-weeler.my.lan
|
47
|
+
* 24:a4:3c:e3:d3:92 -> bob-louie-sancher-rimando.my.lan
|
48
|
+
|
49
|
+
MAC addresses with same OID part (24:a4:3c in this case) generates the same
|
50
|
+
middle name ("Louie Sancher" in the example above), therefore it is possible to
|
51
|
+
guess server (or NIC) vendor from it, or it should be possible to shorten
|
52
|
+
middle names (e.g. bobby-ls-weeler.my.lan) in homogeneous environments.
|
53
|
+
|
54
|
+
## Comparison of types
|
55
|
+
|
56
|
+
MAC-based advantages
|
57
|
+
|
58
|
+
* reprovisioning the same server generates the same name
|
59
|
+
* middle names are same for unique hardware vendors
|
60
|
+
|
61
|
+
MAC-based disadvantages
|
62
|
+
|
63
|
+
* name is longer
|
64
|
+
|
65
|
+
Random-based advantages
|
66
|
+
|
67
|
+
* name is shorter
|
68
|
+
|
69
|
+
Random-based disadvantages
|
70
|
+
|
71
|
+
* reprovisioning the same server generates different name
|
72
|
+
|
73
|
+
## Usage
|
74
|
+
|
75
|
+
Random LFSR non-repeating generator example:
|
76
|
+
|
77
|
+
require "deacon"
|
78
|
+
register = Deacon::RandomGenerator::random_initial_seed
|
79
|
+
generator = Deacon::RandomGenerator.new
|
80
|
+
(1..5).each do |_|
|
81
|
+
# store the register in non-volatile memory (e.g. on disk)
|
82
|
+
register, firstname, lastname = generator.generate(register)
|
83
|
+
puts firstname + ' ' + lastname
|
84
|
+
end
|
85
|
+
|
86
|
+
Example output:
|
87
|
+
|
88
|
+
LOREN SPAHN
|
89
|
+
JULIO GIMBEL
|
90
|
+
CORY SIBILIO
|
91
|
+
PATSY CUSSON
|
92
|
+
HUGH SHIMER
|
93
|
+
|
94
|
+
Random LFSR generator example:
|
95
|
+
|
96
|
+
require "deacon"
|
97
|
+
generator = Deacon::RandomGenerator.new
|
98
|
+
(1..5).each do |_|
|
99
|
+
# ignoring the register can lead to duplicities!
|
100
|
+
_, firstname, lastname = generator.generate
|
101
|
+
puts firstname + ' ' + lastname
|
102
|
+
end
|
103
|
+
|
104
|
+
MAC generator example:
|
105
|
+
|
106
|
+
require "deacon"
|
107
|
+
generator = Deacon::MacGenerator.new
|
108
|
+
firstname, lastname = generator.generate("AA:BB:CC:DD:EE:FF")
|
109
|
+
puts firstname + ' ' + lastname
|
110
|
+
|
111
|
+
## Contributing
|
112
|
+
|
113
|
+
Fork and send a Pull Request. Thanks!
|
114
|
+
|
115
|
+
## Copyright
|
116
|
+
|
117
|
+
Copyright (c) 2016 Lukas Zapletal
|
118
|
+
|
119
|
+
This program is free software: you can redistribute it and/or modify
|
120
|
+
it under the terms of the GNU General Public License as published by
|
121
|
+
the Free Software Foundation, either version 3 of the License, or
|
122
|
+
(at your option) any later version.
|
123
|
+
|
124
|
+
This program is distributed in the hope that it will be useful,
|
125
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
126
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
127
|
+
GNU General Public License for more details.
|
128
|
+
|
129
|
+
You should have received a copy of the GNU General Public License
|
130
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
131
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'rake/testtask'
|
9
|
+
|
10
|
+
Rake::TestTask.new(:test) do |t|
|
11
|
+
t.libs << 'lib'
|
12
|
+
t.libs << 'test'
|
13
|
+
t.pattern = 'test/**/*_test.rb'
|
14
|
+
t.verbose = false
|
15
|
+
end
|
16
|
+
|
17
|
+
task default: :test
|
data/data/gfnames.txt
ADDED
@@ -0,0 +1,256 @@
|
|
1
|
+
VELMA
|
2
|
+
ELENA
|
3
|
+
PATSY
|
4
|
+
TERI
|
5
|
+
LOIS
|
6
|
+
ROSA
|
7
|
+
LUZ
|
8
|
+
NELL
|
9
|
+
PENNY
|
10
|
+
LEIGH
|
11
|
+
TERRI
|
12
|
+
TAMI
|
13
|
+
EVA
|
14
|
+
CORA
|
15
|
+
LUCY
|
16
|
+
SALLY
|
17
|
+
JODIE
|
18
|
+
LEOLA
|
19
|
+
BETSY
|
20
|
+
KATIE
|
21
|
+
CARLA
|
22
|
+
EDNA
|
23
|
+
ELISE
|
24
|
+
ETTA
|
25
|
+
BECKY
|
26
|
+
CATHY
|
27
|
+
JOY
|
28
|
+
ELISA
|
29
|
+
JOSIE
|
30
|
+
LILY
|
31
|
+
FLORA
|
32
|
+
KARIN
|
33
|
+
DIXIE
|
34
|
+
MISTY
|
35
|
+
DIANA
|
36
|
+
FREDA
|
37
|
+
ELLA
|
38
|
+
WILMA
|
39
|
+
PAM
|
40
|
+
DELIA
|
41
|
+
JAYNE
|
42
|
+
VICKY
|
43
|
+
LYDIA
|
44
|
+
DELLA
|
45
|
+
INA
|
46
|
+
PEARL
|
47
|
+
JOYCE
|
48
|
+
SONIA
|
49
|
+
CLEO
|
50
|
+
LORI
|
51
|
+
ROSE
|
52
|
+
HAZEL
|
53
|
+
SARA
|
54
|
+
PAIGE
|
55
|
+
MARLA
|
56
|
+
EFFIE
|
57
|
+
CARA
|
58
|
+
PATTY
|
59
|
+
DEBRA
|
60
|
+
KELLI
|
61
|
+
NANCY
|
62
|
+
ESTER
|
63
|
+
EULA
|
64
|
+
RONDA
|
65
|
+
TARA
|
66
|
+
MABEL
|
67
|
+
KARLA
|
68
|
+
JUDY
|
69
|
+
JANIS
|
70
|
+
TASHA
|
71
|
+
LORA
|
72
|
+
DAWN
|
73
|
+
AMY
|
74
|
+
GRACE
|
75
|
+
IRENE
|
76
|
+
LILA
|
77
|
+
BETTY
|
78
|
+
AIMEE
|
79
|
+
RENEE
|
80
|
+
ANNE
|
81
|
+
ERIN
|
82
|
+
DONNA
|
83
|
+
LINDA
|
84
|
+
LYNNE
|
85
|
+
LOLA
|
86
|
+
GAIL
|
87
|
+
SONYA
|
88
|
+
TRINA
|
89
|
+
LORNA
|
90
|
+
MEGAN
|
91
|
+
EDITH
|
92
|
+
LENA
|
93
|
+
CANDY
|
94
|
+
NAOMI
|
95
|
+
DORIS
|
96
|
+
LAURA
|
97
|
+
SANDY
|
98
|
+
PETRA
|
99
|
+
ERICA
|
100
|
+
HOPE
|
101
|
+
SHARI
|
102
|
+
ADA
|
103
|
+
JULIA
|
104
|
+
ERMA
|
105
|
+
HILDA
|
106
|
+
JILL
|
107
|
+
MELBA
|
108
|
+
SUSIE
|
109
|
+
LISA
|
110
|
+
DAISY
|
111
|
+
ALMA
|
112
|
+
VICKI
|
113
|
+
ANA
|
114
|
+
IDA
|
115
|
+
TINA
|
116
|
+
LACEY
|
117
|
+
ELVA
|
118
|
+
MOLLY
|
119
|
+
KERRI
|
120
|
+
LUPE
|
121
|
+
OLA
|
122
|
+
SHANA
|
123
|
+
LYNDA
|
124
|
+
IRIS
|
125
|
+
ALISA
|
126
|
+
ANITA
|
127
|
+
DORA
|
128
|
+
ANGIE
|
129
|
+
SUSAN
|
130
|
+
KERI
|
131
|
+
ELLEN
|
132
|
+
TONYA
|
133
|
+
VIOLA
|
134
|
+
OLLIE
|
135
|
+
NORA
|
136
|
+
TAMMY
|
137
|
+
REBA
|
138
|
+
AMBER
|
139
|
+
STACI
|
140
|
+
IVA
|
141
|
+
CHERI
|
142
|
+
EMMA
|
143
|
+
AGNES
|
144
|
+
VERA
|
145
|
+
MARTA
|
146
|
+
TANYA
|
147
|
+
AIDA
|
148
|
+
JOAN
|
149
|
+
APRIL
|
150
|
+
RUBY
|
151
|
+
HOLLY
|
152
|
+
FERN
|
153
|
+
MAY
|
154
|
+
RUTH
|
155
|
+
HEIDI
|
156
|
+
JENNA
|
157
|
+
LUCIA
|
158
|
+
DINA
|
159
|
+
FAITH
|
160
|
+
MINDY
|
161
|
+
NIKKI
|
162
|
+
CAROL
|
163
|
+
JEWEL
|
164
|
+
JANA
|
165
|
+
DARLA
|
166
|
+
KATE
|
167
|
+
JULIE
|
168
|
+
LULA
|
169
|
+
WENDY
|
170
|
+
PATTI
|
171
|
+
LELA
|
172
|
+
GWEN
|
173
|
+
MAE
|
174
|
+
KAREN
|
175
|
+
GAYLE
|
176
|
+
JODI
|
177
|
+
MANDY
|
178
|
+
MARIE
|
179
|
+
JUNE
|
180
|
+
JUANA
|
181
|
+
KAY
|
182
|
+
GINA
|
183
|
+
MONA
|
184
|
+
MYRA
|
185
|
+
POLLY
|
186
|
+
TRACI
|
187
|
+
ELSIE
|
188
|
+
LEAH
|
189
|
+
PEGGY
|
190
|
+
KARI
|
191
|
+
LEA
|
192
|
+
CELIA
|
193
|
+
MARIA
|
194
|
+
ETHEL
|
195
|
+
IRMA
|
196
|
+
MARY
|
197
|
+
TRUDY
|
198
|
+
SUE
|
199
|
+
ORA
|
200
|
+
RITA
|
201
|
+
INEZ
|
202
|
+
ELSA
|
203
|
+
ALTA
|
204
|
+
ADDIE
|
205
|
+
MYRNA
|
206
|
+
MAMIE
|
207
|
+
VERNA
|
208
|
+
ESSIE
|
209
|
+
SADIE
|
210
|
+
JENNY
|
211
|
+
LEONA
|
212
|
+
LANA
|
213
|
+
JOANN
|
214
|
+
NINA
|
215
|
+
TONIA
|
216
|
+
DENA
|
217
|
+
ANNA
|
218
|
+
LOU
|
219
|
+
MAUDE
|
220
|
+
JANET
|
221
|
+
ANN
|
222
|
+
HELEN
|
223
|
+
OLIVE
|
224
|
+
EBONY
|
225
|
+
ANNIE
|
226
|
+
ROSIE
|
227
|
+
RENA
|
228
|
+
MABLE
|
229
|
+
SONJA
|
230
|
+
KARA
|
231
|
+
JANE
|
232
|
+
JANIE
|
233
|
+
CINDY
|
234
|
+
PAULA
|
235
|
+
JONI
|
236
|
+
EMILY
|
237
|
+
KAYLA
|
238
|
+
FAY
|
239
|
+
SARAH
|
240
|
+
ADELE
|
241
|
+
MAYRA
|
242
|
+
BETH
|
243
|
+
DIANE
|
244
|
+
NORMA
|
245
|
+
ROBYN
|
246
|
+
SHERI
|
247
|
+
ERIKA
|
248
|
+
OLGA
|
249
|
+
FAYE
|
250
|
+
WANDA
|
251
|
+
TONI
|
252
|
+
BETTE
|
253
|
+
OPAL
|
254
|
+
CLARA
|
255
|
+
KATHY
|
256
|
+
ALICE
|
data/data/gmnames.txt
ADDED
@@ -0,0 +1,256 @@
|
|
1
|
+
ALTON
|
2
|
+
GRANT
|
3
|
+
GARRY
|
4
|
+
LANCE
|
5
|
+
CORY
|
6
|
+
KARL
|
7
|
+
HOMER
|
8
|
+
BRET
|
9
|
+
TED
|
10
|
+
JULIO
|
11
|
+
ELI
|
12
|
+
ROMAN
|
13
|
+
MYRON
|
14
|
+
DAMON
|
15
|
+
CALEB
|
16
|
+
GARY
|
17
|
+
JOSE
|
18
|
+
DANA
|
19
|
+
SETH
|
20
|
+
LOREN
|
21
|
+
DEWEY
|
22
|
+
DARYL
|
23
|
+
JOHN
|
24
|
+
DALE
|
25
|
+
MOSES
|
26
|
+
STEVE
|
27
|
+
WILL
|
28
|
+
DEVIN
|
29
|
+
DAN
|
30
|
+
ROYCE
|
31
|
+
RICK
|
32
|
+
ELDON
|
33
|
+
AARON
|
34
|
+
TERRY
|
35
|
+
TIMMY
|
36
|
+
WADE
|
37
|
+
JOSH
|
38
|
+
CLYDE
|
39
|
+
KENNY
|
40
|
+
ALAN
|
41
|
+
KURT
|
42
|
+
ABEL
|
43
|
+
EDDIE
|
44
|
+
JEFF
|
45
|
+
NEAL
|
46
|
+
JAIME
|
47
|
+
MERLE
|
48
|
+
JAN
|
49
|
+
SHANE
|
50
|
+
MARK
|
51
|
+
JUAN
|
52
|
+
GREG
|
53
|
+
ROCKY
|
54
|
+
GLEN
|
55
|
+
OWEN
|
56
|
+
EMIL
|
57
|
+
OSCAR
|
58
|
+
RUDY
|
59
|
+
GREGG
|
60
|
+
MILES
|
61
|
+
LOUIE
|
62
|
+
JIMMY
|
63
|
+
MARCO
|
64
|
+
ERVIN
|
65
|
+
SAM
|
66
|
+
AMOS
|
67
|
+
LEO
|
68
|
+
ERIK
|
69
|
+
TROY
|
70
|
+
OMAR
|
71
|
+
TOBY
|
72
|
+
GUY
|
73
|
+
ANDY
|
74
|
+
JON
|
75
|
+
CODY
|
76
|
+
GLENN
|
77
|
+
OTTO
|
78
|
+
DOUG
|
79
|
+
JODY
|
80
|
+
DOYLE
|
81
|
+
BRUCE
|
82
|
+
BEN
|
83
|
+
TOMMY
|
84
|
+
JIM
|
85
|
+
IRVIN
|
86
|
+
PAT
|
87
|
+
CHRIS
|
88
|
+
PETE
|
89
|
+
BRAD
|
90
|
+
CARY
|
91
|
+
KELLY
|
92
|
+
GENE
|
93
|
+
BRYAN
|
94
|
+
ALEX
|
95
|
+
JAY
|
96
|
+
LEON
|
97
|
+
CECIL
|
98
|
+
KENT
|
99
|
+
GRADY
|
100
|
+
CLINT
|
101
|
+
BRIAN
|
102
|
+
CHAD
|
103
|
+
PHIL
|
104
|
+
BRETT
|
105
|
+
ROSS
|
106
|
+
MICAH
|
107
|
+
CRAIG
|
108
|
+
KYLE
|
109
|
+
ALLAN
|
110
|
+
NICK
|
111
|
+
COLIN
|
112
|
+
IAN
|
113
|
+
RAY
|
114
|
+
LUIS
|
115
|
+
JAMIE
|
116
|
+
RANDY
|
117
|
+
NEIL
|
118
|
+
LAMAR
|
119
|
+
JESS
|
120
|
+
PAUL
|
121
|
+
MIKE
|
122
|
+
LEROY
|
123
|
+
JORGE
|
124
|
+
OTIS
|
125
|
+
LEWIS
|
126
|
+
BOYD
|
127
|
+
RENE
|
128
|
+
DUANE
|
129
|
+
DON
|
130
|
+
HUGH
|
131
|
+
JESUS
|
132
|
+
ELMER
|
133
|
+
CLARK
|
134
|
+
MARTY
|
135
|
+
LEE
|
136
|
+
ALLEN
|
137
|
+
BLAKE
|
138
|
+
FRED
|
139
|
+
DAVID
|
140
|
+
EVAN
|
141
|
+
RYAN
|
142
|
+
IVAN
|
143
|
+
KERRY
|
144
|
+
JOE
|
145
|
+
FRANK
|
146
|
+
TOMAS
|
147
|
+
ERIC
|
148
|
+
ETHAN
|
149
|
+
KEVIN
|
150
|
+
RUBEN
|
151
|
+
ALVIN
|
152
|
+
IRA
|
153
|
+
VAN
|
154
|
+
RON
|
155
|
+
ADAM
|
156
|
+
SHAWN
|
157
|
+
BERT
|
158
|
+
KEITH
|
159
|
+
TODD
|
160
|
+
CARL
|
161
|
+
HEATH
|
162
|
+
DANNY
|
163
|
+
PEDRO
|
164
|
+
KIM
|
165
|
+
NOAH
|
166
|
+
LUKE
|
167
|
+
DYLAN
|
168
|
+
DARIN
|
169
|
+
JESSE
|
170
|
+
ANGEL
|
171
|
+
LYLE
|
172
|
+
RAMON
|
173
|
+
NOEL
|
174
|
+
JOEY
|
175
|
+
EARL
|
176
|
+
LUCAS
|
177
|
+
JASON
|
178
|
+
JARED
|
179
|
+
BRENT
|
180
|
+
LOUIS
|
181
|
+
ANDRE
|
182
|
+
BYRON
|
183
|
+
TEDDY
|
184
|
+
SHAUN
|
185
|
+
PERCY
|
186
|
+
MATT
|
187
|
+
TYLER
|
188
|
+
BILL
|
189
|
+
RUFUS
|
190
|
+
FLOYD
|
191
|
+
HARRY
|
192
|
+
MARIO
|
193
|
+
JAKE
|
194
|
+
HENRY
|
195
|
+
FELIX
|
196
|
+
JAMES
|
197
|
+
ISAAC
|
198
|
+
CASEY
|
199
|
+
DAVE
|
200
|
+
TIM
|
201
|
+
PERRY
|
202
|
+
LLOYD
|
203
|
+
LEVI
|
204
|
+
JACOB
|
205
|
+
PETER
|
206
|
+
MARC
|
207
|
+
STACY
|
208
|
+
TRACY
|
209
|
+
BRYCE
|
210
|
+
COREY
|
211
|
+
TOM
|
212
|
+
ELIAS
|
213
|
+
PABLO
|
214
|
+
JOEL
|
215
|
+
SEAN
|
216
|
+
DREW
|
217
|
+
LYNN
|
218
|
+
SCOTT
|
219
|
+
BENNY
|
220
|
+
RICKY
|
221
|
+
BILLY
|
222
|
+
ROGER
|
223
|
+
ERICK
|
224
|
+
MACK
|
225
|
+
LARRY
|
226
|
+
EDGAR
|
227
|
+
KIRK
|
228
|
+
BOB
|
229
|
+
KEN
|
230
|
+
JERRY
|
231
|
+
CHASE
|
232
|
+
WAYNE
|
233
|
+
BARRY
|
234
|
+
CLAY
|
235
|
+
SAUL
|
236
|
+
JACK
|
237
|
+
BOBBY
|
238
|
+
REX
|
239
|
+
JEAN
|
240
|
+
SIMON
|
241
|
+
ELLIS
|
242
|
+
MAX
|
243
|
+
TONY
|
244
|
+
EDWIN
|
245
|
+
ROBIN
|
246
|
+
RALPH
|
247
|
+
HUGO
|
248
|
+
DEAN
|
249
|
+
CESAR
|
250
|
+
ROY
|
251
|
+
TRENT
|
252
|
+
ELTON
|
253
|
+
LOGAN
|
254
|
+
SAMMY
|
255
|
+
DEREK
|
256
|
+
RAUL
|