l1a_prep 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/Gemfile.lock +71 -0
- data/l1a_prep-0.1.0.gem +0 -0
- data/l1a_prep.gemspec +2 -1
- data/lib/.DS_Store +0 -0
- data/lib/l1a_prep/.DS_Store +0 -0
- data/lib/l1a_prep/fireworks.sh +169 -0
- data/lib/l1a_prep/l1a-prep.rb +672 -664
- data/lib/l1a_prep/version.rb +1 -1
- metadata +36 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d6940c70dea5c0f4733957eaa1a9b85ffd77424b71828537c2da8223f031185
|
4
|
+
data.tar.gz: b0b219fc7c6200401b796e57ae39cc91f52c85eb8a52de1da3c9d20c297bbd3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 871af127cd5e5a74c941c81298e3ec522f1f164b55aafcea6ff8de052e3542a4ff7886b642d7cf9cb83075785f96cf4df04bbe469ca52585245753d134f9df26
|
7
|
+
data.tar.gz: a262af5a99394ee5ae8f34a3f47327610f4134bd885203e2a2f8cc60ce289175b41c5173be4786ee5eca7440c5b6a4694e1407e6f6c29f967fc97c68feb2d831
|
data/.DS_Store
CHANGED
Binary file
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
l1a_prep (1.0.0)
|
5
|
+
colorize (>= 0.8.0)
|
6
|
+
tty-prompt (>= 0.22.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.2)
|
12
|
+
colorize (0.8.1)
|
13
|
+
diff-lcs (1.4.4)
|
14
|
+
parallel (1.20.1)
|
15
|
+
parser (3.0.0.0)
|
16
|
+
ast (~> 2.4.1)
|
17
|
+
pastel (0.8.0)
|
18
|
+
tty-color (~> 0.5)
|
19
|
+
rainbow (3.0.0)
|
20
|
+
rake (13.0.3)
|
21
|
+
regexp_parser (2.1.1)
|
22
|
+
rexml (3.2.5)
|
23
|
+
rspec (3.10.0)
|
24
|
+
rspec-core (~> 3.10.0)
|
25
|
+
rspec-expectations (~> 3.10.0)
|
26
|
+
rspec-mocks (~> 3.10.0)
|
27
|
+
rspec-core (3.10.1)
|
28
|
+
rspec-support (~> 3.10.0)
|
29
|
+
rspec-expectations (3.10.1)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.10.0)
|
32
|
+
rspec-mocks (3.10.2)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.10.0)
|
35
|
+
rspec-support (3.10.2)
|
36
|
+
rubocop (1.12.1)
|
37
|
+
parallel (~> 1.10)
|
38
|
+
parser (>= 3.0.0.0)
|
39
|
+
rainbow (>= 2.2.2, < 4.0)
|
40
|
+
regexp_parser (>= 1.8, < 3.0)
|
41
|
+
rexml
|
42
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
43
|
+
ruby-progressbar (~> 1.7)
|
44
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
45
|
+
rubocop-ast (1.4.1)
|
46
|
+
parser (>= 2.7.1.5)
|
47
|
+
ruby-progressbar (1.11.0)
|
48
|
+
tty-color (0.6.0)
|
49
|
+
tty-cursor (0.7.1)
|
50
|
+
tty-prompt (0.23.0)
|
51
|
+
pastel (~> 0.8)
|
52
|
+
tty-reader (~> 0.8)
|
53
|
+
tty-reader (0.9.0)
|
54
|
+
tty-cursor (~> 0.7)
|
55
|
+
tty-screen (~> 0.8)
|
56
|
+
wisper (~> 2.0)
|
57
|
+
tty-screen (0.8.1)
|
58
|
+
unicode-display_width (2.0.0)
|
59
|
+
wisper (2.0.1)
|
60
|
+
|
61
|
+
PLATFORMS
|
62
|
+
ruby
|
63
|
+
|
64
|
+
DEPENDENCIES
|
65
|
+
l1a_prep!
|
66
|
+
rake (~> 13.0)
|
67
|
+
rspec (~> 3.0)
|
68
|
+
rubocop (~> 1.7)
|
69
|
+
|
70
|
+
BUNDLED WITH
|
71
|
+
1.17.2
|
data/l1a_prep-0.1.0.gem
ADDED
Binary file
|
data/l1a_prep.gemspec
CHANGED
@@ -30,7 +30,8 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
# Uncomment to register a new dependency of your gem
|
33
|
-
|
33
|
+
spec.add_dependency "tty-prompt", ">= 0.22.0"
|
34
|
+
spec.add_dependency "colorize", ">= 0.8.0"
|
34
35
|
|
35
36
|
# For more information and examples about making a new gem, checkout our
|
36
37
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/lib/.DS_Store
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,169 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
rows=$(tput lines)
|
4
|
+
cols=$(tput cols)
|
5
|
+
colors=(red green blue purple cyan yellow brown)
|
6
|
+
lock_file=
|
7
|
+
lock_file_base=/tmp/$(basename $0 .sh)
|
8
|
+
|
9
|
+
multiple=0
|
10
|
+
if [[ "$1" ]]; then
|
11
|
+
nsingle=$1
|
12
|
+
shift
|
13
|
+
else
|
14
|
+
nsingle=10
|
15
|
+
fi
|
16
|
+
if [[ "$1" ]]; then
|
17
|
+
nmultiple=$1
|
18
|
+
shift
|
19
|
+
if [[ $nmultiple -gt 8 ]]; then nmultiple=8; fi
|
20
|
+
else
|
21
|
+
nmultiple=6
|
22
|
+
fi
|
23
|
+
|
24
|
+
|
25
|
+
function colorstr()
|
26
|
+
{
|
27
|
+
local row=$1
|
28
|
+
local col=$2
|
29
|
+
local color=$3
|
30
|
+
local v
|
31
|
+
case "$color" in
|
32
|
+
red) v=31;;
|
33
|
+
green) v=34;;
|
34
|
+
blue) v=32;;
|
35
|
+
purple) v=35;;
|
36
|
+
cyan) v=36;;
|
37
|
+
yellow) v=33;;
|
38
|
+
brown) v=33;;
|
39
|
+
white) v=37;;
|
40
|
+
*) v=;;
|
41
|
+
esac
|
42
|
+
shift 3
|
43
|
+
|
44
|
+
if [[ $multiple -ne 0 ]]; then
|
45
|
+
touch $lock_file
|
46
|
+
while [[ $(ls $lock_file_base.* 2>/dev/null | head -n 1) != $lock_file ]]
|
47
|
+
do
|
48
|
+
sleep 0.05
|
49
|
+
done
|
50
|
+
fi
|
51
|
+
|
52
|
+
tput cup $row $col
|
53
|
+
echo -n -e "\e["$v"m"
|
54
|
+
set -f
|
55
|
+
echo -n $*
|
56
|
+
set +f
|
57
|
+
if [[ $multiple -ne 0 ]]; then
|
58
|
+
rm -f $lock_file
|
59
|
+
fi
|
60
|
+
}
|
61
|
+
|
62
|
+
function center_colorstr()
|
63
|
+
{
|
64
|
+
local row=$1
|
65
|
+
local color=$2
|
66
|
+
shift 2
|
67
|
+
local s="$*"
|
68
|
+
local slen=${#s}
|
69
|
+
colorstr $row $(((cols / 2) - (slen / 2))) $color "$s"
|
70
|
+
}
|
71
|
+
|
72
|
+
function fireworks()
|
73
|
+
{
|
74
|
+
local row=$((rows - 1))
|
75
|
+
local col=$(((RANDOM % (cols / 2)) + (cols / 4)))
|
76
|
+
local height=$((RANDOM % rows - 2))
|
77
|
+
local slant
|
78
|
+
local h
|
79
|
+
local color1=${colors[$((RANDOM % ${#colors[*]}))]}
|
80
|
+
local color2=${colors[$((RANDOM % ${#colors[*]}))]}
|
81
|
+
local color3=${colors[$((RANDOM % ${#colors[*]}))]}
|
82
|
+
while [[ $color1 == $color2 || $color1 == $color3 || $color2 == $color3 ]]
|
83
|
+
do
|
84
|
+
color2=${colors[$((RANDOM % ${#colors[*]}))]}
|
85
|
+
color3=${colors[$((RANDOM % ${#colors[*]}))]}
|
86
|
+
done
|
87
|
+
|
88
|
+
case $((RANDOM % 4)) in
|
89
|
+
0) slant=-2;;
|
90
|
+
1) slant=-1;;
|
91
|
+
2) slant=1;;
|
92
|
+
3) slant=2;;
|
93
|
+
esac
|
94
|
+
|
95
|
+
if [[ $height -gt 5 ]]; then
|
96
|
+
h=$height
|
97
|
+
|
98
|
+
while [[ $h -gt 0 ]]
|
99
|
+
do
|
100
|
+
colorstr $row $col $color1 '.'
|
101
|
+
let row--
|
102
|
+
if [[ $((col + slant)) -ge $((cols - 3)) || $((col + slant)) -le 2 ]]; then break; fi
|
103
|
+
let col+=slant
|
104
|
+
let h--
|
105
|
+
sleep 0.1
|
106
|
+
done
|
107
|
+
|
108
|
+
if [[ $((col + slant)) -lt $((cols - 3)) && $((col + slant)) -gt 2 ]]; then
|
109
|
+
|
110
|
+
h=$((height / 5))
|
111
|
+
|
112
|
+
while [[ $h -gt 0 ]]
|
113
|
+
do
|
114
|
+
colorstr $row $col $color2 '.'
|
115
|
+
let row++
|
116
|
+
if [[ $((col + slant)) -ge $((cols - 3)) || $((col + slant)) -le 2 ]]; then break; fi
|
117
|
+
let col+=slant
|
118
|
+
let h--
|
119
|
+
sleep 0.1
|
120
|
+
done
|
121
|
+
fi
|
122
|
+
|
123
|
+
colorstr $((row)) $((col - 1)) $color3 '***'
|
124
|
+
colorstr $((row - 1)) $((col)) $color3 '*'
|
125
|
+
colorstr $((row + 1)) $((col)) $color3 '*'
|
126
|
+
fi
|
127
|
+
}
|
128
|
+
|
129
|
+
for i in $(seq 1 $nsingle)
|
130
|
+
do
|
131
|
+
clear
|
132
|
+
fireworks
|
133
|
+
sleep 1
|
134
|
+
done
|
135
|
+
|
136
|
+
clear
|
137
|
+
|
138
|
+
pids=
|
139
|
+
for i in $(seq 1 $nmultiple)
|
140
|
+
do
|
141
|
+
let multiple++
|
142
|
+
lock_file=$lock_file_base.$i
|
143
|
+
fireworks &
|
144
|
+
pids="$pids $!"
|
145
|
+
done
|
146
|
+
|
147
|
+
trap "kill -9 $pids 2>/dev/null" EXIT
|
148
|
+
|
149
|
+
wait $pids
|
150
|
+
sleep 3
|
151
|
+
|
152
|
+
clear
|
153
|
+
|
154
|
+
echo ''
|
155
|
+
echo ''
|
156
|
+
echo ''
|
157
|
+
echo ''
|
158
|
+
echo -e "\t Where there's focus, there is progress!"
|
159
|
+
echo ''
|
160
|
+
echo -e "\t Go crush the L1A!"
|
161
|
+
echo ''
|
162
|
+
echo -e "\t WP Engine ... LFG!"
|
163
|
+
|
164
|
+
sleep 5
|
165
|
+
clear
|
166
|
+
|
167
|
+
|
168
|
+
# vim: tabstop=4: shiftwidth=4: noexpandtab:
|
169
|
+
# kate: tab-width 4; indent-width 4; replace-tabs false;
|
data/lib/l1a_prep/l1a-prep.rb
CHANGED
@@ -1,664 +1,672 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
# prints the WP Engine text in CLI screen
|
7
|
-
|
8
|
-
def self.logo
|
9
|
-
|
10
|
-
puts "
|
11
|
-
|
12
|
-
888
|
13
|
-
888
|
14
|
-
888
|
15
|
-
888
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
"
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
puts ''
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
puts ''
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
menu.choice '
|
69
|
-
menu.choice '
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
puts ''
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
puts ''
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
answer
|
95
|
-
|
96
|
-
|
97
|
-
puts ''
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
puts ''
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
answer
|
117
|
-
|
118
|
-
|
119
|
-
puts ''
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
puts ''
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
answer
|
139
|
-
|
140
|
-
|
141
|
-
puts ''
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
puts ''
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
answer
|
161
|
-
|
162
|
-
|
163
|
-
puts ''
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
puts ''
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
answer
|
183
|
-
|
184
|
-
|
185
|
-
puts ''
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
puts ''
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
puts ''
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
puts ''
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
puts ''
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
puts ''
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
answer
|
256
|
-
|
257
|
-
|
258
|
-
puts ''
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
puts ''
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
answer
|
278
|
-
|
279
|
-
|
280
|
-
puts ''
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
puts ''
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
answer
|
300
|
-
|
301
|
-
|
302
|
-
puts ''
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
puts ''
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
answer
|
322
|
-
|
323
|
-
|
324
|
-
puts ''
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
puts ''
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
answer
|
345
|
-
|
346
|
-
|
347
|
-
puts ''
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
puts ''
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
answer
|
367
|
-
|
368
|
-
|
369
|
-
puts ''
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
puts ''
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
answer
|
389
|
-
|
390
|
-
|
391
|
-
puts ''
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
puts ''
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
answer
|
411
|
-
|
412
|
-
|
413
|
-
puts ''
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
puts ''
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
answer
|
433
|
-
|
434
|
-
|
435
|
-
puts ''
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
puts ''
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
answer
|
455
|
-
|
456
|
-
|
457
|
-
puts ''
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
puts ''
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
puts ''
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
puts ''
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
puts ''
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
puts ''
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
answer
|
529
|
-
|
530
|
-
|
531
|
-
puts ''
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
puts ''
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
answer
|
551
|
-
|
552
|
-
|
553
|
-
puts ''
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
puts ''
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
answer
|
573
|
-
|
574
|
-
|
575
|
-
puts ''
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
puts ''
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
answer
|
595
|
-
|
596
|
-
|
597
|
-
puts ''
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
puts ''
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
menu.choice '
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
puts ''
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
puts ''
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
answer
|
644
|
-
|
645
|
-
|
646
|
-
puts ''
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
puts ''
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
self.
|
664
|
-
|
1
|
+
require 'tty-prompt'
|
2
|
+
require 'colorize'
|
3
|
+
|
4
|
+
class L1aPrep
|
5
|
+
|
6
|
+
# prints the WP Engine text in CLI screen
|
7
|
+
|
8
|
+
def self.logo
|
9
|
+
|
10
|
+
puts "
|
11
|
+
888 8888888888b. 8888888888 d8b
|
12
|
+
888 o 888888 Y88b 888 Y8P
|
13
|
+
888 d8b 888888 888 888
|
14
|
+
888 d888b 888888 d88P 8888888 88888b. .d88b. 88888888b. .d88b.
|
15
|
+
888d88888b8888888888P 888 888 88bd88P 88b888888 8bd8P Y8b
|
16
|
+
88888P Y88888888 888 888 888888 888888888 88888888888
|
17
|
+
8888P Y8888888 888 888 888Y88b 888888888 888Y8b.
|
18
|
+
888P Y888888 8888888888888 888 Y88888888888 888 Y8888
|
19
|
+
888
|
20
|
+
Y8b d88P
|
21
|
+
Y88P
|
22
|
+
".green
|
23
|
+
puts "
|
24
|
+
** Pass the L1A Assessment **
|
25
|
+
".green
|
26
|
+
end
|
27
|
+
|
28
|
+
self.logo
|
29
|
+
|
30
|
+
def self.questions
|
31
|
+
|
32
|
+
# score
|
33
|
+
|
34
|
+
@num_of_q = 0
|
35
|
+
@correct = 0
|
36
|
+
|
37
|
+
# question 1
|
38
|
+
|
39
|
+
prompt = TTY::Prompt.new
|
40
|
+
question = 'The primary migration process you will use as an L1a'
|
41
|
+
choices = %w(magic reparent internal geo-targeted)
|
42
|
+
answer = prompt.select(question, choices)
|
43
|
+
if answer == "magic"
|
44
|
+
puts ''
|
45
|
+
puts ' >> Correct! Magic Migrations are set in overdrive'
|
46
|
+
puts ''
|
47
|
+
@num_of_q += 1
|
48
|
+
@correct += 1
|
49
|
+
else
|
50
|
+
puts ''
|
51
|
+
puts ' >> Not quite... moving right along!'
|
52
|
+
puts ''
|
53
|
+
@num_of_q += 1
|
54
|
+
@correct = @correct
|
55
|
+
end
|
56
|
+
|
57
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
58
|
+
puts ''
|
59
|
+
|
60
|
+
# question 2
|
61
|
+
|
62
|
+
prompt = TTY::Prompt.new
|
63
|
+
|
64
|
+
answer = prompt.select('What is a M2p Migration?') do |menu|
|
65
|
+
|
66
|
+
menu.choice 'Member to Peer'
|
67
|
+
menu.choice 'Member to Platform'
|
68
|
+
menu.choice 'Move to preferred'
|
69
|
+
menu.choice 'Move to Peer'
|
70
|
+
end
|
71
|
+
|
72
|
+
if answer == "Move to preferred"
|
73
|
+
puts ''
|
74
|
+
puts ' >> Correct! Manual migration that can be done from the terminal (only to be used if the magic functionality is not available)'
|
75
|
+
puts ''
|
76
|
+
@num_of_q += 1
|
77
|
+
@correct += 1
|
78
|
+
else
|
79
|
+
puts ''
|
80
|
+
puts ' >> Not quite... Move to Preferred. Moving right along!'
|
81
|
+
puts ''
|
82
|
+
@num_of_q += 1
|
83
|
+
@correct = @correct
|
84
|
+
end
|
85
|
+
|
86
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
87
|
+
puts ''
|
88
|
+
|
89
|
+
# question 3
|
90
|
+
|
91
|
+
prompt = TTY::Prompt.new
|
92
|
+
answer = prompt.ask('File location of the Nginx access log? ... use \'install\' as the site name')
|
93
|
+
|
94
|
+
if answer == "/var/log/nginx/install.access.log"
|
95
|
+
puts ''
|
96
|
+
puts ' >> Correct!'
|
97
|
+
puts ''
|
98
|
+
@num_of_q += 1
|
99
|
+
@correct += 1
|
100
|
+
else
|
101
|
+
puts ''
|
102
|
+
puts ' >> Not quite... /var/log/nginx/install.access.log'
|
103
|
+
puts ''
|
104
|
+
@num_of_q += 1
|
105
|
+
@correct = @correct
|
106
|
+
end
|
107
|
+
|
108
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
109
|
+
puts ''
|
110
|
+
|
111
|
+
# question 4
|
112
|
+
|
113
|
+
prompt = TTY::Prompt.new
|
114
|
+
answer = prompt.ask('File location of the apachestyle Nginx access log? ... use \'install\' as the site name')
|
115
|
+
|
116
|
+
if answer == "/var/log/nginx/install.apachestyle.log"
|
117
|
+
puts ''
|
118
|
+
puts ' >> Correct! Note that the apachestyle logs are the Nginx logs, but keep the same formatting of the Apache logs'
|
119
|
+
puts ''
|
120
|
+
@num_of_q += 1
|
121
|
+
@correct += 1
|
122
|
+
else
|
123
|
+
puts ''
|
124
|
+
puts ' >> Not quite... /var/log/nginx/install.apachestyle.log'
|
125
|
+
puts ''
|
126
|
+
@num_of_q += 1
|
127
|
+
@correct = @correct
|
128
|
+
end
|
129
|
+
|
130
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
131
|
+
puts ''
|
132
|
+
|
133
|
+
# question 5
|
134
|
+
|
135
|
+
prompt = TTY::Prompt.new
|
136
|
+
answer = prompt.ask('File location for logs of killed apache processes?')
|
137
|
+
|
138
|
+
if answer == "/var/log/apache-killed-by-wpe.log"
|
139
|
+
puts ''
|
140
|
+
puts ' >> Correct!'
|
141
|
+
puts ''
|
142
|
+
@num_of_q += 1
|
143
|
+
@correct += 1
|
144
|
+
else
|
145
|
+
puts ''
|
146
|
+
puts ' >> Not quite... /var/log/apache-killed-by-wpe.log'
|
147
|
+
puts ''
|
148
|
+
@num_of_q += 1
|
149
|
+
@correct = @correct
|
150
|
+
end
|
151
|
+
|
152
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
153
|
+
puts ''
|
154
|
+
|
155
|
+
# question 6
|
156
|
+
|
157
|
+
prompt = TTY::Prompt.new
|
158
|
+
answer = prompt.ask('File location of the apache access log? ... use \'install\' as the site name')
|
159
|
+
|
160
|
+
if answer == "/var/log/apache2/install.access.log"
|
161
|
+
puts ''
|
162
|
+
puts ' >> Correct!'
|
163
|
+
puts ''
|
164
|
+
@num_of_q += 1
|
165
|
+
@correct += 1
|
166
|
+
else
|
167
|
+
puts ''
|
168
|
+
puts ' >> Not quite... /var/log/apache2/install.access.log'
|
169
|
+
puts ''
|
170
|
+
@num_of_q += 1
|
171
|
+
@correct = @correct
|
172
|
+
end
|
173
|
+
|
174
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
175
|
+
puts ''
|
176
|
+
|
177
|
+
# question 7
|
178
|
+
|
179
|
+
prompt = TTY::Prompt.new
|
180
|
+
answer = prompt.ask('File location of the apache error log? ... use \'install\' as the site name')
|
181
|
+
|
182
|
+
if answer == "/var/log/apache2/install.error.log"
|
183
|
+
puts ''
|
184
|
+
puts ' >> Correct!'
|
185
|
+
puts ''
|
186
|
+
@num_of_q += 1
|
187
|
+
@correct += 1
|
188
|
+
else
|
189
|
+
puts ''
|
190
|
+
puts ' >> Not quite... /var/log/apache2/install.error.log'
|
191
|
+
puts ''
|
192
|
+
@num_of_q += 1
|
193
|
+
@correct = @correct
|
194
|
+
end
|
195
|
+
|
196
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
197
|
+
puts ''
|
198
|
+
|
199
|
+
# question 8
|
200
|
+
|
201
|
+
prompt = TTY::Prompt.new
|
202
|
+
answer = prompt.select('$time_local|v1|$remote_addr|$http_host|$status|$body_bytes_sent|$upst ream_addr|$upstream_response_time|$request_time|$request|$is_logge d_as_bot|$is_prefetch|$http_cf_ray') do |menu|
|
203
|
+
menu.choice 'Apache log'
|
204
|
+
menu.choice 'Nginx log'
|
205
|
+
end
|
206
|
+
|
207
|
+
if answer == "Nginx log"
|
208
|
+
puts ''
|
209
|
+
puts ' >> Correct!'
|
210
|
+
puts ''
|
211
|
+
@num_of_q += 1
|
212
|
+
@correct += 1
|
213
|
+
else
|
214
|
+
puts ''
|
215
|
+
puts ' >> Not quite... this is a Nginx log'
|
216
|
+
puts ''
|
217
|
+
@num_of_q += 1
|
218
|
+
@correct = @correct
|
219
|
+
end
|
220
|
+
|
221
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
222
|
+
puts ''
|
223
|
+
|
224
|
+
# question 9
|
225
|
+
|
226
|
+
prompt = TTY::Prompt.new
|
227
|
+
|
228
|
+
answer = prompt.select('$remote_addr $http_host $remote_user [$time_local] $request $status $body_bytes_sent $http_referer $wpe_user_agent') do |menu|
|
229
|
+
menu.choice 'Apache log'
|
230
|
+
menu.choice 'Nginx log'
|
231
|
+
end
|
232
|
+
|
233
|
+
if answer == "Apache log"
|
234
|
+
puts ''
|
235
|
+
puts ' >> Correct!'
|
236
|
+
puts ''
|
237
|
+
@num_of_q += 1
|
238
|
+
@correct += 1
|
239
|
+
else
|
240
|
+
puts ''
|
241
|
+
puts ' >> Not quite... this is a Apache log'
|
242
|
+
puts ''
|
243
|
+
@num_of_q += 1
|
244
|
+
@correct = @correct
|
245
|
+
end
|
246
|
+
|
247
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
248
|
+
puts ''
|
249
|
+
|
250
|
+
# question 10
|
251
|
+
|
252
|
+
prompt = TTY::Prompt.new
|
253
|
+
answer = prompt.ask('Linux command to output the first 10 lines of the file called wpengine.txt')
|
254
|
+
|
255
|
+
if answer == "head wpengine.txt"
|
256
|
+
puts ''
|
257
|
+
puts ' >> Correct!'
|
258
|
+
puts ''
|
259
|
+
@num_of_q += 1
|
260
|
+
@correct += 1
|
261
|
+
else
|
262
|
+
puts ''
|
263
|
+
puts ' >> Not quite... head wpengine.txt'
|
264
|
+
puts ''
|
265
|
+
@num_of_q += 1
|
266
|
+
@correct = @correct
|
267
|
+
end
|
268
|
+
|
269
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
270
|
+
puts ''
|
271
|
+
|
272
|
+
# question 11
|
273
|
+
|
274
|
+
prompt = TTY::Prompt.new
|
275
|
+
answer = prompt.ask('Linux command to output the last 10 lines of wpengine.txt')
|
276
|
+
|
277
|
+
if answer == "tail wpengine.txt"
|
278
|
+
puts ''
|
279
|
+
puts ' >> Correct!'
|
280
|
+
puts ''
|
281
|
+
@num_of_q += 1
|
282
|
+
@correct += 1
|
283
|
+
else
|
284
|
+
puts ''
|
285
|
+
puts ' >> Not quite... tail wpengine.txt'
|
286
|
+
puts ''
|
287
|
+
@num_of_q += 1
|
288
|
+
@correct = @correct
|
289
|
+
end
|
290
|
+
|
291
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
292
|
+
puts ''
|
293
|
+
|
294
|
+
# question 12
|
295
|
+
|
296
|
+
prompt = TTY::Prompt.new
|
297
|
+
answer = prompt.ask('Linux command to show directory space usage in KB/MB/GB')
|
298
|
+
|
299
|
+
if answer == "du -sh *"
|
300
|
+
puts ''
|
301
|
+
puts ' >> Correct!'
|
302
|
+
puts ''
|
303
|
+
@num_of_q += 1
|
304
|
+
@correct += 1
|
305
|
+
else
|
306
|
+
puts ''
|
307
|
+
puts ' >> Not quite... du -sh *'
|
308
|
+
puts ''
|
309
|
+
@num_of_q += 1
|
310
|
+
@correct = @correct
|
311
|
+
end
|
312
|
+
|
313
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
314
|
+
puts ''
|
315
|
+
|
316
|
+
# question 13
|
317
|
+
|
318
|
+
prompt = TTY::Prompt.new
|
319
|
+
answer = prompt.ask('Linux command to show disk usage... mainly for the cluster, shows the % at which the server is loading memory')
|
320
|
+
|
321
|
+
if answer == "df -h"
|
322
|
+
puts ''
|
323
|
+
puts ' >> Correct!'
|
324
|
+
puts ''
|
325
|
+
@num_of_q += 1
|
326
|
+
@correct += 1
|
327
|
+
else
|
328
|
+
puts ''
|
329
|
+
puts ' >> Not quite... df -h'
|
330
|
+
puts ''
|
331
|
+
@num_of_q += 1
|
332
|
+
@correct = @correct
|
333
|
+
end
|
334
|
+
|
335
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
336
|
+
puts ''
|
337
|
+
|
338
|
+
|
339
|
+
# question 14
|
340
|
+
|
341
|
+
prompt = TTY::Prompt.new
|
342
|
+
answer = prompt.ask('Linux command to show how much CPU % and Memory % is being used and which processes are using them the most')
|
343
|
+
|
344
|
+
if answer == "htop"
|
345
|
+
puts ''
|
346
|
+
puts ' >> Correct!'
|
347
|
+
puts ''
|
348
|
+
@num_of_q += 1
|
349
|
+
@correct += 1
|
350
|
+
else
|
351
|
+
puts ''
|
352
|
+
puts ' >> Not quite... htop'
|
353
|
+
puts ''
|
354
|
+
@num_of_q += 1
|
355
|
+
@correct = @correct
|
356
|
+
end
|
357
|
+
|
358
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
359
|
+
puts ''
|
360
|
+
|
361
|
+
# question 15
|
362
|
+
|
363
|
+
prompt = TTY::Prompt.new
|
364
|
+
answer = prompt.ask('Linux command to show the status of the server throughout a specific point in time')
|
365
|
+
|
366
|
+
if answer == "sar -q"
|
367
|
+
puts ''
|
368
|
+
puts ' >> Correct!'
|
369
|
+
puts ''
|
370
|
+
@num_of_q += 1
|
371
|
+
@correct += 1
|
372
|
+
else
|
373
|
+
puts ''
|
374
|
+
puts ' >> Not quite... sar -q'
|
375
|
+
puts ''
|
376
|
+
@num_of_q += 1
|
377
|
+
@correct = @correct
|
378
|
+
end
|
379
|
+
|
380
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
381
|
+
puts ''
|
382
|
+
|
383
|
+
# question 16
|
384
|
+
|
385
|
+
prompt = TTY::Prompt.new
|
386
|
+
answer = prompt.ask('Linux command to show the number of cores currently on the server/cluster')
|
387
|
+
|
388
|
+
if answer == "nproc"
|
389
|
+
puts ''
|
390
|
+
puts ' >> Correct!'
|
391
|
+
puts ''
|
392
|
+
@num_of_q += 1
|
393
|
+
@correct += 1
|
394
|
+
else
|
395
|
+
puts ''
|
396
|
+
puts ' >> Not quite... nproc'
|
397
|
+
puts ''
|
398
|
+
@num_of_q += 1
|
399
|
+
@correct = @correct
|
400
|
+
end
|
401
|
+
|
402
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
403
|
+
puts ''
|
404
|
+
|
405
|
+
# question 17
|
406
|
+
|
407
|
+
prompt = TTY::Prompt.new
|
408
|
+
answer = prompt.ask('Linux command to find the amount of Memory on a current server and how much is being utilized')
|
409
|
+
|
410
|
+
if answer == "free"
|
411
|
+
puts ''
|
412
|
+
puts ' >> Correct!'
|
413
|
+
puts ''
|
414
|
+
@num_of_q += 1
|
415
|
+
@correct += 1
|
416
|
+
else
|
417
|
+
puts ''
|
418
|
+
puts ' >> Not quite... free'
|
419
|
+
puts ''
|
420
|
+
@num_of_q += 1
|
421
|
+
@correct = @correct
|
422
|
+
end
|
423
|
+
|
424
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
425
|
+
puts ''
|
426
|
+
|
427
|
+
# question 18
|
428
|
+
|
429
|
+
prompt = TTY::Prompt.new
|
430
|
+
answer = prompt.ask('What\'s the WP-CLI command you\'d run, when reverting a site from core version 5.7 to 5.5.6?')
|
431
|
+
|
432
|
+
if answer == "wp core update --version=5.5.6 --force"
|
433
|
+
puts ''
|
434
|
+
puts ' >> Correct!'
|
435
|
+
puts ''
|
436
|
+
@num_of_q += 1
|
437
|
+
@correct += 1
|
438
|
+
else
|
439
|
+
puts ''
|
440
|
+
puts ' >> Not quite... wp core update --version=5.5.6 --force'
|
441
|
+
puts ''
|
442
|
+
@num_of_q += 1
|
443
|
+
@correct = @correct
|
444
|
+
end
|
445
|
+
|
446
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
447
|
+
puts ''
|
448
|
+
|
449
|
+
# question 19
|
450
|
+
|
451
|
+
prompt = TTY::Prompt.new
|
452
|
+
answer = prompt.ask('Linux command to find all files with extention .git')
|
453
|
+
|
454
|
+
if answer == "find -name \"*.git\""
|
455
|
+
puts ''
|
456
|
+
puts ' >> Correct!'
|
457
|
+
puts ''
|
458
|
+
@num_of_q += 1
|
459
|
+
@correct += 1
|
460
|
+
else
|
461
|
+
puts ''
|
462
|
+
puts ' >> Not quite... find -name \"*.git\"'
|
463
|
+
puts ''
|
464
|
+
@num_of_q += 1
|
465
|
+
@correct = @correct
|
466
|
+
end
|
467
|
+
|
468
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
469
|
+
puts ''
|
470
|
+
|
471
|
+
# question 20
|
472
|
+
|
473
|
+
prompt = TTY::Prompt.new
|
474
|
+
|
475
|
+
answer = prompt.select('/nas/config/live/installname/ is a ...') do |menu|
|
476
|
+
menu.choice 'Absolute Path'
|
477
|
+
menu.choice 'Relative Path'
|
478
|
+
end
|
479
|
+
|
480
|
+
if answer == "Absolute Path"
|
481
|
+
puts ''
|
482
|
+
puts ' >> Correct! Referring to everything based on the root directory and always starting with a /'
|
483
|
+
puts ''
|
484
|
+
@num_of_q += 1
|
485
|
+
@correct += 1
|
486
|
+
else
|
487
|
+
puts ''
|
488
|
+
puts ' >> Not quite... Absolute Path'
|
489
|
+
puts ''
|
490
|
+
@num_of_q += 1
|
491
|
+
@correct = @correct
|
492
|
+
end
|
493
|
+
|
494
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
495
|
+
puts ''
|
496
|
+
|
497
|
+
# question 21
|
498
|
+
|
499
|
+
prompt = TTY::Prompt.new
|
500
|
+
|
501
|
+
answer = prompt.select('_wpeprivate/ is a ...') do |menu|
|
502
|
+
menu.choice 'Absolute Path'
|
503
|
+
menu.choice 'Relative Path'
|
504
|
+
end
|
505
|
+
|
506
|
+
if answer == "Relative Path"
|
507
|
+
puts ''
|
508
|
+
puts ' >> Correct! Command on what you want to operate on relative to where you are. Interacts with current directory.'
|
509
|
+
puts ''
|
510
|
+
@num_of_q += 1
|
511
|
+
@correct += 1
|
512
|
+
else
|
513
|
+
puts ''
|
514
|
+
puts ' >> Not quite... Relative Path'
|
515
|
+
puts ''
|
516
|
+
@num_of_q += 1
|
517
|
+
@correct = @correct
|
518
|
+
end
|
519
|
+
|
520
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
521
|
+
puts ''
|
522
|
+
|
523
|
+
# question 22
|
524
|
+
|
525
|
+
prompt = TTY::Prompt.new
|
526
|
+
answer = prompt.ask('Cut command to find top ten page requests, requested by googlebot from 10-11 am utc: ... use \'install\' as the name of the envrionment + the year 2021')
|
527
|
+
|
528
|
+
if answer == "grep \'2021:10\' /var/log/nginx/install.apachestyle.log | grep -i \'googlebot\' | cut -d\' \' -f2 | sort | uniq -c | sort -nr | head"
|
529
|
+
puts ''
|
530
|
+
puts ' >> Correct!'
|
531
|
+
puts ''
|
532
|
+
@num_of_q += 1
|
533
|
+
@correct += 1
|
534
|
+
else
|
535
|
+
puts ''
|
536
|
+
puts ' >> Not quite... grep \'2021:10\' /var/log/nginx/install.apachestyle.log | grep -i \'googlebot\' | cut -d\' \' -f2 | sort | uniq -c | sort -nr | head'
|
537
|
+
puts ''
|
538
|
+
@num_of_q += 1
|
539
|
+
@correct = @correct
|
540
|
+
end
|
541
|
+
|
542
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
543
|
+
puts ''
|
544
|
+
|
545
|
+
# question 23
|
546
|
+
|
547
|
+
prompt = TTY::Prompt.new
|
548
|
+
answer = prompt.ask('Cut command to find Top Ten IP’s that hit today ... use the \'install\' as the name of the environment')
|
549
|
+
|
550
|
+
if answer == "cut -d\" \" -f1 /var/log/nginx/install.apachestyle.log | sort | uniq -c | sort -rn | head"
|
551
|
+
puts ''
|
552
|
+
puts ' >> Correct!'
|
553
|
+
puts ''
|
554
|
+
@num_of_q += 1
|
555
|
+
@correct += 1
|
556
|
+
else
|
557
|
+
puts ''
|
558
|
+
puts ' >> Not quite... cut -d\' \' -f1 /var/log/nginx/install.apachestyle.log | sort | uniq -c | sort -rn | head'
|
559
|
+
puts ''
|
560
|
+
@num_of_q += 1
|
561
|
+
@correct = @correct
|
562
|
+
end
|
563
|
+
|
564
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
565
|
+
puts ''
|
566
|
+
|
567
|
+
# question 24
|
568
|
+
|
569
|
+
prompt = TTY::Prompt.new
|
570
|
+
answer = prompt.ask('Top ten pages that Googlebot hit 2 days ago ... use the \'install\' as the name of the environment')
|
571
|
+
|
572
|
+
if answer == "zgrep \'Googlebot\' /var/log/nginx/install.apachestyle.log.2.gz | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head"
|
573
|
+
puts ''
|
574
|
+
puts ' >> Correct!'
|
575
|
+
puts ''
|
576
|
+
@num_of_q += 1
|
577
|
+
@correct += 1
|
578
|
+
else
|
579
|
+
puts ''
|
580
|
+
puts ' >> Not quite... zgrep \'Googlebot\' /var/log/nginx/install.apachestyle.log.2.gz | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head'
|
581
|
+
puts ''
|
582
|
+
@num_of_q += 1
|
583
|
+
@correct = @correct
|
584
|
+
end
|
585
|
+
|
586
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
587
|
+
puts ''
|
588
|
+
|
589
|
+
# question 25
|
590
|
+
|
591
|
+
prompt = TTY::Prompt.new
|
592
|
+
answer = prompt.ask('Top ten pages that Googlebot has hit today ... use the \'install\' as the name of the environment')
|
593
|
+
|
594
|
+
if answer == "grep \'Googlebot\' /var/log/nginx/install.apachestyle.log | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head"
|
595
|
+
puts ''
|
596
|
+
puts ' >> Correct!'
|
597
|
+
puts ''
|
598
|
+
@num_of_q += 1
|
599
|
+
@correct += 1
|
600
|
+
else
|
601
|
+
puts ''
|
602
|
+
puts ' >> Not quite... grep \'Googlebot\' /var/log/nginx/install.apachestyle.log | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head'
|
603
|
+
puts ''
|
604
|
+
@num_of_q += 1
|
605
|
+
@correct = @correct
|
606
|
+
end
|
607
|
+
|
608
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
609
|
+
puts ''
|
610
|
+
|
611
|
+
# question 26
|
612
|
+
|
613
|
+
prompt = TTY::Prompt.new
|
614
|
+
|
615
|
+
answer = prompt.select('Which type of log will show the user agent?') do |menu|
|
616
|
+
menu.choice 'Nginx'
|
617
|
+
menu.choice 'Apachestyle Nginx'
|
618
|
+
menu.choice 'Apache'
|
619
|
+
end
|
620
|
+
|
621
|
+
if answer == "Apachestyle Nginx"
|
622
|
+
puts ''
|
623
|
+
puts ' >> Correct!'
|
624
|
+
puts ''
|
625
|
+
@num_of_q += 1
|
626
|
+
@correct += 1
|
627
|
+
else
|
628
|
+
puts ''
|
629
|
+
puts ' >> Not quite... Apachestyle Nginx'
|
630
|
+
puts ''
|
631
|
+
@num_of_q += 1
|
632
|
+
@correct = @correct
|
633
|
+
end
|
634
|
+
|
635
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
636
|
+
puts ''
|
637
|
+
|
638
|
+
# question 27
|
639
|
+
|
640
|
+
prompt = TTY::Prompt.new
|
641
|
+
answer = prompt.ask('Top Ten pages that had a 504 response code')
|
642
|
+
|
643
|
+
if answer == "grep \"504\" /var/log/nginx/install.apachestyle.log | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head"
|
644
|
+
puts ''
|
645
|
+
puts ' >> Correct!'
|
646
|
+
puts ''
|
647
|
+
@num_of_q += 1
|
648
|
+
@correct += 1
|
649
|
+
else
|
650
|
+
puts ''
|
651
|
+
puts ' >> Not quite... grep \"504\" /var/log/nginx/install.apachestyle.log | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head'
|
652
|
+
puts ''
|
653
|
+
@num_of_q += 1
|
654
|
+
@correct = @correct
|
655
|
+
end
|
656
|
+
|
657
|
+
puts " | #{@correct} | out of #{@num_of_q} questions correct".green
|
658
|
+
puts ''
|
659
|
+
end
|
660
|
+
|
661
|
+
self.questions
|
662
|
+
|
663
|
+
def self.fireworks
|
664
|
+
system("bash fireworks.sh")
|
665
|
+
end
|
666
|
+
|
667
|
+
self.fireworks
|
668
|
+
|
669
|
+
end
|
670
|
+
|
671
|
+
|
672
|
+
|