l1a_prep 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +13 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +12 -0
- data/l1a_prep.gemspec +37 -0
- data/lib/l1a_prep.rb +8 -0
- data/lib/l1a_prep/l1a-prep.rb +664 -0
- data/lib/l1a_prep/version.rb +5 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bd399c44491027e64319d2a8cbdde4d4353bd41b1f7d271fbdeead7fa4d77112
|
4
|
+
data.tar.gz: b9ee44786c667ed4da9dc3f7483787171963fae0c9be14f712a41975c12982b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a6e3d4044a2724c91c9c62d49995db425e99a9087b8dbf54bc9dd4334de067e45e12e8e9e7c6d34ba5cc705758949d394ab75e135f7b0c2efdb33d89251cf722
|
7
|
+
data.tar.gz: 40a57042e602b6251b6e29ecf7fb6f6f654e912efed87f705ec41ce15b5e3eb66e064c312a9f0287c12a5e200a87a3aba398fde03272ebe278eac152389325a4
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 <github username>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# L1aPrep
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/l1a_prep`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'l1a_prep'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install l1a_prep
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
You'll need Ruby installed to run this application. Ruby can be installed here: https://www.ruby-lang.org/en/downloads/
|
26
|
+
|
27
|
+
`To run the application, open the cli and enter:`
|
28
|
+
|
29
|
+
$ ruby l1a-prep
|
30
|
+
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
35
|
+
|
36
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/<github username>/l1a_prep.
|
41
|
+
|
42
|
+
## License
|
43
|
+
|
44
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/l1a_prep.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/l1a_prep/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "l1a_prep"
|
7
|
+
spec.version = L1aPrep::VERSION
|
8
|
+
spec.authors = ["Kyle Crews"]
|
9
|
+
spec.email = ["dev.kylecrews@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Simple quiz application to prep for the L1A Assessment"
|
12
|
+
spec.description = "CLI Quiz to prep for the L1A Assessment"
|
13
|
+
spec.homepage = "https://github.com/kyle-crews/L1A-Prep"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
16
|
+
|
17
|
+
#spec.metadata["allowed_push_host"] = "https://github.com/kyle-crews/L1A-Prep"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
21
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
# Uncomment to register a new dependency of your gem
|
33
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
34
|
+
|
35
|
+
# For more information and examples about making a new gem, checkout our
|
36
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
37
|
+
end
|
data/lib/l1a_prep.rb
ADDED
@@ -0,0 +1,664 @@
|
|
1
|
+
class L1aPrep
|
2
|
+
|
3
|
+
require 'tty-prompt'
|
4
|
+
require 'colorize'
|
5
|
+
|
6
|
+
# prints the WP Engine text in CLI screen
|
7
|
+
|
8
|
+
def self.logo
|
9
|
+
|
10
|
+
puts "
|
11
|
+
|
12
|
+
888 8888888888b. 8888888888 d8b
|
13
|
+
888 o 888888 Y88b 888 Y8P
|
14
|
+
888 d8b 888888 888 888
|
15
|
+
888 d888b 888888 d88P 8888888 88888b. .d88b. 88888888b. .d88b.
|
16
|
+
888d88888b8888888888P 888 888 88bd88P 88b888888 8bd8P Y8b
|
17
|
+
88888P Y88888888 888 888 888888 888888888 88888888888
|
18
|
+
8888P Y8888888 888 888 888Y88b 888888888 888Y8b.
|
19
|
+
888P Y888888 8888888888888 888 Y88888888888 888 Y8888
|
20
|
+
888
|
21
|
+
Y8b d88P
|
22
|
+
Y88P
|
23
|
+
".green
|
24
|
+
puts "
|
25
|
+
** Pass the L1A Assessment **
|
26
|
+
".green
|
27
|
+
end
|
28
|
+
|
29
|
+
self.logo
|
30
|
+
|
31
|
+
|
32
|
+
def self.questions
|
33
|
+
|
34
|
+
# score
|
35
|
+
|
36
|
+
@num_of_q = 0
|
37
|
+
@correct = 0
|
38
|
+
|
39
|
+
# question 1
|
40
|
+
|
41
|
+
prompt = TTY::Prompt.new
|
42
|
+
question = 'The primary migration process you will use as an L1a'
|
43
|
+
choices = %w(magic reparent internal geo-targeted)
|
44
|
+
answer = prompt.select(question, choices)
|
45
|
+
if answer == "magic"
|
46
|
+
puts ''
|
47
|
+
puts ' >> Correct! Magic Migrations are set in overdrive'
|
48
|
+
puts ''
|
49
|
+
@num_of_q += 1
|
50
|
+
@correct += 1
|
51
|
+
else
|
52
|
+
puts ''
|
53
|
+
puts ' >> Not quite... moving right along!'
|
54
|
+
puts ''
|
55
|
+
@num_of_q += 1
|
56
|
+
@correct = @correct
|
57
|
+
end
|
58
|
+
|
59
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
60
|
+
puts ''
|
61
|
+
|
62
|
+
# question 2
|
63
|
+
|
64
|
+
prompt = TTY::Prompt.new
|
65
|
+
|
66
|
+
answer = prompt.select('What is a M2p Migration?') do |menu|
|
67
|
+
|
68
|
+
menu.choice 'Member to Peer'
|
69
|
+
menu.choice 'Member to Platform'
|
70
|
+
menu.choice 'Move to preferred'
|
71
|
+
menu.choice 'Move to Peer'
|
72
|
+
end
|
73
|
+
|
74
|
+
if answer == "Move to preferred"
|
75
|
+
puts ''
|
76
|
+
puts ' >> Correct! Manual migration that can be done from the terminal (only to be used if the magic functionality is not available)'
|
77
|
+
puts ''
|
78
|
+
@num_of_q += 1
|
79
|
+
@correct += 1
|
80
|
+
else
|
81
|
+
puts ''
|
82
|
+
puts ' >> Not quite... moving right along!'
|
83
|
+
puts ''
|
84
|
+
@num_of_q += 1
|
85
|
+
@correct = @correct
|
86
|
+
end
|
87
|
+
|
88
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
89
|
+
puts ''
|
90
|
+
|
91
|
+
# question 3
|
92
|
+
|
93
|
+
prompt = TTY::Prompt.new
|
94
|
+
answer = prompt.ask('File location of the Nginx access log? ... use >> install. << as the site name')
|
95
|
+
|
96
|
+
if answer == "/var/log/nginx/install.access.log"
|
97
|
+
puts ''
|
98
|
+
puts ' >> Correct!'
|
99
|
+
puts ''
|
100
|
+
@num_of_q += 1
|
101
|
+
@correct += 1
|
102
|
+
else
|
103
|
+
puts ''
|
104
|
+
puts ' >> Not quite... /var/log/nginx/install.access.log'
|
105
|
+
puts ''
|
106
|
+
@num_of_q += 1
|
107
|
+
@correct = @correct
|
108
|
+
end
|
109
|
+
|
110
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
111
|
+
puts ''
|
112
|
+
|
113
|
+
# question 4
|
114
|
+
|
115
|
+
prompt = TTY::Prompt.new
|
116
|
+
answer = prompt.ask('File location of the apachestyle Nginx access log? ... use >> install. << as the site name')
|
117
|
+
|
118
|
+
if answer == "/var/log/nginx/install.apachestyle.log"
|
119
|
+
puts ''
|
120
|
+
puts ' >> Correct! Note that the apachestyle logs are the Nginx logs, but keep the same formatting of the Apache logs'
|
121
|
+
puts ''
|
122
|
+
@num_of_q += 1
|
123
|
+
@correct += 1
|
124
|
+
else
|
125
|
+
puts ''
|
126
|
+
puts ' >> Not quite... /var/log/nginx/install.apachestyle.log'
|
127
|
+
puts ''
|
128
|
+
@num_of_q += 1
|
129
|
+
@correct = @correct
|
130
|
+
end
|
131
|
+
|
132
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
133
|
+
puts ''
|
134
|
+
|
135
|
+
# question 5
|
136
|
+
|
137
|
+
prompt = TTY::Prompt.new
|
138
|
+
answer = prompt.ask('Log location of the processes killed by apache?')
|
139
|
+
|
140
|
+
if answer == "/var/log/apache-killed-by-wpe.log"
|
141
|
+
puts ''
|
142
|
+
puts ' >> Correct!'
|
143
|
+
puts ''
|
144
|
+
@num_of_q += 1
|
145
|
+
@correct += 1
|
146
|
+
else
|
147
|
+
puts ''
|
148
|
+
puts ' >> Not quite... /var/log/apache-killed-by-wpe.log'
|
149
|
+
puts ''
|
150
|
+
@num_of_q += 1
|
151
|
+
@correct = @correct
|
152
|
+
end
|
153
|
+
|
154
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
155
|
+
puts ''
|
156
|
+
|
157
|
+
# question 6
|
158
|
+
|
159
|
+
prompt = TTY::Prompt.new
|
160
|
+
answer = prompt.ask('File location of the apache access log? ... use >> install. << as the site name')
|
161
|
+
|
162
|
+
if answer == "/var/log/apache2/install.access.log"
|
163
|
+
puts ''
|
164
|
+
puts ' >> Correct!'
|
165
|
+
puts ''
|
166
|
+
@num_of_q += 1
|
167
|
+
@correct += 1
|
168
|
+
else
|
169
|
+
puts ''
|
170
|
+
puts ' >> Not quite... /var/log/apache2/install.access.log'
|
171
|
+
puts ''
|
172
|
+
@num_of_q += 1
|
173
|
+
@correct = @correct
|
174
|
+
end
|
175
|
+
|
176
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
177
|
+
puts ''
|
178
|
+
|
179
|
+
# question 7
|
180
|
+
|
181
|
+
prompt = TTY::Prompt.new
|
182
|
+
answer = prompt.ask('File location of the apache error log? ... use >> install. as the site name')
|
183
|
+
|
184
|
+
if answer == "/var/log/apache2/install.error.log"
|
185
|
+
puts ''
|
186
|
+
puts ' >> Correct!'
|
187
|
+
puts ''
|
188
|
+
@num_of_q += 1
|
189
|
+
@correct += 1
|
190
|
+
else
|
191
|
+
puts ''
|
192
|
+
puts ' >> Not quite... /var/log/apache2/install.error.log'
|
193
|
+
puts ''
|
194
|
+
@num_of_q += 1
|
195
|
+
@correct = @correct
|
196
|
+
end
|
197
|
+
|
198
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
199
|
+
puts ''
|
200
|
+
|
201
|
+
# question 8
|
202
|
+
|
203
|
+
prompt = TTY::Prompt.new
|
204
|
+
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|
|
205
|
+
menu.choice 'Apache log'
|
206
|
+
menu.choice 'Nginx log'
|
207
|
+
end
|
208
|
+
|
209
|
+
if answer == "Nginx log"
|
210
|
+
puts ''
|
211
|
+
puts ' >> Correct!'
|
212
|
+
puts ''
|
213
|
+
@num_of_q += 1
|
214
|
+
@correct += 1
|
215
|
+
else
|
216
|
+
puts ''
|
217
|
+
puts ' >> Not quite... this is a Nginx log'
|
218
|
+
puts ''
|
219
|
+
@num_of_q += 1
|
220
|
+
@correct = @correct
|
221
|
+
end
|
222
|
+
|
223
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
224
|
+
puts ''
|
225
|
+
|
226
|
+
# question 9
|
227
|
+
|
228
|
+
prompt = TTY::Prompt.new
|
229
|
+
|
230
|
+
answer = prompt.select('$remote_addr $http_host $remote_user [$time_local] $request $status $body_bytes_sent $http_referer $wpe_user_agent') do |menu|
|
231
|
+
menu.choice 'Apache log'
|
232
|
+
menu.choice 'Nginx log'
|
233
|
+
end
|
234
|
+
|
235
|
+
if answer == "Apache log"
|
236
|
+
puts ''
|
237
|
+
puts ' >> Correct!'
|
238
|
+
puts ''
|
239
|
+
@num_of_q += 1
|
240
|
+
@correct += 1
|
241
|
+
else
|
242
|
+
puts ''
|
243
|
+
puts ' >> Not quite... this is a Apache log'
|
244
|
+
puts ''
|
245
|
+
@num_of_q += 1
|
246
|
+
@correct = @correct
|
247
|
+
end
|
248
|
+
|
249
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
250
|
+
puts ''
|
251
|
+
|
252
|
+
# question 10
|
253
|
+
|
254
|
+
prompt = TTY::Prompt.new
|
255
|
+
answer = prompt.ask('Linux command to output the first 10 lines of the file called wpengine.txt')
|
256
|
+
|
257
|
+
if answer == "head wpengine.txt"
|
258
|
+
puts ''
|
259
|
+
puts ' >> Correct!'
|
260
|
+
puts ''
|
261
|
+
@num_of_q += 1
|
262
|
+
@correct += 1
|
263
|
+
else
|
264
|
+
puts ''
|
265
|
+
puts ' >> Not quite... head wpengine.txt'
|
266
|
+
puts ''
|
267
|
+
@num_of_q += 1
|
268
|
+
@correct = @correct
|
269
|
+
end
|
270
|
+
|
271
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
272
|
+
puts ''
|
273
|
+
|
274
|
+
# question 11
|
275
|
+
|
276
|
+
prompt = TTY::Prompt.new
|
277
|
+
answer = prompt.ask('Linux command to output the last 10 lines of wpengine.txt')
|
278
|
+
|
279
|
+
if answer == "tail wpengine.txt"
|
280
|
+
puts ''
|
281
|
+
puts ' >> Correct!'
|
282
|
+
puts ''
|
283
|
+
@num_of_q += 1
|
284
|
+
@correct += 1
|
285
|
+
else
|
286
|
+
puts ''
|
287
|
+
puts ' >> Not quite... tail wpengine.txt'
|
288
|
+
puts ''
|
289
|
+
@num_of_q += 1
|
290
|
+
@correct = @correct
|
291
|
+
end
|
292
|
+
|
293
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
294
|
+
puts ''
|
295
|
+
|
296
|
+
# question 12
|
297
|
+
|
298
|
+
prompt = TTY::Prompt.new
|
299
|
+
answer = prompt.ask('Linux command to show directory space usage in KB/MB/GB')
|
300
|
+
|
301
|
+
if answer == "du -sh *"
|
302
|
+
puts ''
|
303
|
+
puts ' >> Correct!'
|
304
|
+
puts ''
|
305
|
+
@num_of_q += 1
|
306
|
+
@correct += 1
|
307
|
+
else
|
308
|
+
puts ''
|
309
|
+
puts ' >> Not quite... du -sh *'
|
310
|
+
puts ''
|
311
|
+
@num_of_q += 1
|
312
|
+
@correct = @correct
|
313
|
+
end
|
314
|
+
|
315
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
316
|
+
puts ''
|
317
|
+
|
318
|
+
# question 11
|
319
|
+
|
320
|
+
prompt = TTY::Prompt.new
|
321
|
+
answer = prompt.ask('Linux command to show disk usage... mainly for the cluster, shows the % at which the server is loading memory')
|
322
|
+
|
323
|
+
if answer == "df -h"
|
324
|
+
puts ''
|
325
|
+
puts ' >> Correct!'
|
326
|
+
puts ''
|
327
|
+
@num_of_q += 1
|
328
|
+
@correct += 1
|
329
|
+
else
|
330
|
+
puts ''
|
331
|
+
puts ' >> Not quite... df -h'
|
332
|
+
puts ''
|
333
|
+
@num_of_q += 1
|
334
|
+
@correct = @correct
|
335
|
+
end
|
336
|
+
|
337
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
338
|
+
puts ''
|
339
|
+
|
340
|
+
|
341
|
+
# question 12
|
342
|
+
|
343
|
+
prompt = TTY::Prompt.new
|
344
|
+
answer = prompt.ask('Linux command to show how much CPU % and Memory % is being used and which processes are using them the most')
|
345
|
+
|
346
|
+
if answer == "htop"
|
347
|
+
puts ''
|
348
|
+
puts ' >> Correct!'
|
349
|
+
puts ''
|
350
|
+
@num_of_q += 1
|
351
|
+
@correct += 1
|
352
|
+
else
|
353
|
+
puts ''
|
354
|
+
puts ' >> Not quite... htop'
|
355
|
+
puts ''
|
356
|
+
@num_of_q += 1
|
357
|
+
@correct = @correct
|
358
|
+
end
|
359
|
+
|
360
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
361
|
+
puts ''
|
362
|
+
|
363
|
+
# question 13
|
364
|
+
|
365
|
+
prompt = TTY::Prompt.new
|
366
|
+
answer = prompt.ask('Linux command to show the status of the server throughout a specific point in time')
|
367
|
+
|
368
|
+
if answer == "sar -q"
|
369
|
+
puts ''
|
370
|
+
puts ' >> Correct!'
|
371
|
+
puts ''
|
372
|
+
@num_of_q += 1
|
373
|
+
@correct += 1
|
374
|
+
else
|
375
|
+
puts ''
|
376
|
+
puts ' >> Not quite... sar -q'
|
377
|
+
puts ''
|
378
|
+
@num_of_q += 1
|
379
|
+
@correct = @correct
|
380
|
+
end
|
381
|
+
|
382
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
383
|
+
puts ''
|
384
|
+
|
385
|
+
# question 14
|
386
|
+
|
387
|
+
prompt = TTY::Prompt.new
|
388
|
+
answer = prompt.ask('Linux command to show the number of cores currently on the server/cluster')
|
389
|
+
|
390
|
+
if answer == "nproc"
|
391
|
+
puts ''
|
392
|
+
puts ' >> Correct!'
|
393
|
+
puts ''
|
394
|
+
@num_of_q += 1
|
395
|
+
@correct += 1
|
396
|
+
else
|
397
|
+
puts ''
|
398
|
+
puts ' >> Not quite... nproc'
|
399
|
+
puts ''
|
400
|
+
@num_of_q += 1
|
401
|
+
@correct = @correct
|
402
|
+
end
|
403
|
+
|
404
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
405
|
+
puts ''
|
406
|
+
|
407
|
+
# question 15
|
408
|
+
|
409
|
+
prompt = TTY::Prompt.new
|
410
|
+
answer = prompt.ask('Linux command to find the amount of Memory on a current server and how much is being utilized')
|
411
|
+
|
412
|
+
if answer == "free"
|
413
|
+
puts ''
|
414
|
+
puts ' >> Correct!'
|
415
|
+
puts ''
|
416
|
+
@num_of_q += 1
|
417
|
+
@correct += 1
|
418
|
+
else
|
419
|
+
puts ''
|
420
|
+
puts ' >> Not quite... free'
|
421
|
+
puts ''
|
422
|
+
@num_of_q += 1
|
423
|
+
@correct = @correct
|
424
|
+
end
|
425
|
+
|
426
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
427
|
+
puts ''
|
428
|
+
|
429
|
+
# question 16
|
430
|
+
|
431
|
+
prompt = TTY::Prompt.new
|
432
|
+
answer = prompt.ask('Linux command to find the amount of Memory on a current server and how much is being utilized')
|
433
|
+
|
434
|
+
if answer == "free"
|
435
|
+
puts ''
|
436
|
+
puts ' >> Correct!'
|
437
|
+
puts ''
|
438
|
+
@num_of_q += 1
|
439
|
+
@correct += 1
|
440
|
+
else
|
441
|
+
puts ''
|
442
|
+
puts ' >> Not quite... free'
|
443
|
+
puts ''
|
444
|
+
@num_of_q += 1
|
445
|
+
@correct = @correct
|
446
|
+
end
|
447
|
+
|
448
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
449
|
+
puts ''
|
450
|
+
|
451
|
+
# question 17
|
452
|
+
|
453
|
+
prompt = TTY::Prompt.new
|
454
|
+
answer = prompt.ask('Linux command to find all files with extention .git')
|
455
|
+
|
456
|
+
if answer == "find -name \"*.git\""
|
457
|
+
puts ''
|
458
|
+
puts ' >> Correct!'
|
459
|
+
puts ''
|
460
|
+
@num_of_q += 1
|
461
|
+
@correct += 1
|
462
|
+
else
|
463
|
+
puts ''
|
464
|
+
puts ' >> Not quite... find -name \"*.git\"'
|
465
|
+
puts ''
|
466
|
+
@num_of_q += 1
|
467
|
+
@correct = @correct
|
468
|
+
end
|
469
|
+
|
470
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
471
|
+
puts ''
|
472
|
+
|
473
|
+
# question 18
|
474
|
+
|
475
|
+
prompt = TTY::Prompt.new
|
476
|
+
|
477
|
+
answer = prompt.select('/nas/config/live/installname/ is a ...') do |menu|
|
478
|
+
menu.choice 'Absolute Path'
|
479
|
+
menu.choice 'Relative Path'
|
480
|
+
end
|
481
|
+
|
482
|
+
if answer == "Absolute Path"
|
483
|
+
puts ''
|
484
|
+
puts ' >> Correct! Referring to everything based on the root directory and always starting with a /'
|
485
|
+
puts ''
|
486
|
+
@num_of_q += 1
|
487
|
+
@correct += 1
|
488
|
+
else
|
489
|
+
puts ''
|
490
|
+
puts ' >> Not quite... Absolute Path'
|
491
|
+
puts ''
|
492
|
+
@num_of_q += 1
|
493
|
+
@correct = @correct
|
494
|
+
end
|
495
|
+
|
496
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
497
|
+
puts ''
|
498
|
+
|
499
|
+
# question 19
|
500
|
+
|
501
|
+
prompt = TTY::Prompt.new
|
502
|
+
|
503
|
+
answer = prompt.select('_wpeprivate/ is a ...') do |menu|
|
504
|
+
menu.choice 'Absolute Path'
|
505
|
+
menu.choice 'Relative Path'
|
506
|
+
end
|
507
|
+
|
508
|
+
if answer == "Relative Path"
|
509
|
+
puts ''
|
510
|
+
puts ' >> Correct! Command on what you want to operate on relative to where you are. Interacts with current directory.'
|
511
|
+
puts ''
|
512
|
+
@num_of_q += 1
|
513
|
+
@correct += 1
|
514
|
+
else
|
515
|
+
puts ''
|
516
|
+
puts ' >> Not quite... Relative Path'
|
517
|
+
puts ''
|
518
|
+
@num_of_q += 1
|
519
|
+
@correct = @correct
|
520
|
+
end
|
521
|
+
|
522
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
523
|
+
puts ''
|
524
|
+
|
525
|
+
# question 20
|
526
|
+
|
527
|
+
prompt = TTY::Prompt.new
|
528
|
+
answer = prompt.ask('Cut command to find top ten page requests, requested by googlebot from 10-11 am utc: ... use the \'install\' as the name of the install')
|
529
|
+
|
530
|
+
if answer == "grep \'2020:10\' /var/log/nginx/install.apachestyle.log | grep -i \'googlebot\' | cut -d\'\"\' -f2 | sort | uniq -c | sort -nr | head"
|
531
|
+
puts ''
|
532
|
+
puts ' >> Correct!'
|
533
|
+
puts ''
|
534
|
+
@num_of_q += 1
|
535
|
+
@correct += 1
|
536
|
+
else
|
537
|
+
puts ''
|
538
|
+
puts ' >> Not quite... grep \'2020:10\' /var/log/nginx/install.apachestyle.log | grep -i \'googlebot\' | cut -d\'\"\' -f2 | sort | uniq -c | sort -nr | head'
|
539
|
+
puts ''
|
540
|
+
@num_of_q += 1
|
541
|
+
@correct = @correct
|
542
|
+
end
|
543
|
+
|
544
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
545
|
+
puts ''
|
546
|
+
|
547
|
+
# question 21
|
548
|
+
|
549
|
+
prompt = TTY::Prompt.new
|
550
|
+
answer = prompt.ask('Cut command to find Top Ten IP’s that hit today ... use the \'install\' as the name of the install')
|
551
|
+
|
552
|
+
if answer == "cut -d\" \" -f1 /var/log/nginx/install.apachestyle.log | sort | uniq -c | sort -rn | head"
|
553
|
+
puts ''
|
554
|
+
puts ' >> Correct!'
|
555
|
+
puts ''
|
556
|
+
@num_of_q += 1
|
557
|
+
@correct += 1
|
558
|
+
else
|
559
|
+
puts ''
|
560
|
+
puts ' >> Not quite... cut -d\' \' -f1 /var/log/nginx/install.apachestyle.log | sort | uniq -c | sort -rn | head'
|
561
|
+
puts ''
|
562
|
+
@num_of_q += 1
|
563
|
+
@correct = @correct
|
564
|
+
end
|
565
|
+
|
566
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
567
|
+
puts ''
|
568
|
+
|
569
|
+
# question 22
|
570
|
+
|
571
|
+
prompt = TTY::Prompt.new
|
572
|
+
answer = prompt.ask('Top ten pages that Googlebot hit 2 days ago')
|
573
|
+
|
574
|
+
if answer == "zgrep \"Googlebot\" /var/log/nginx/coinrivet.apachestyle.log.2.gz | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head"
|
575
|
+
puts ''
|
576
|
+
puts ' >> Correct!'
|
577
|
+
puts ''
|
578
|
+
@num_of_q += 1
|
579
|
+
@correct += 1
|
580
|
+
else
|
581
|
+
puts ''
|
582
|
+
puts ' >> Not quite... zgrep \"Googlebot\" /var/log/nginx/coinrivet.apachestyle.log.2.gz | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head'
|
583
|
+
puts ''
|
584
|
+
@num_of_q += 1
|
585
|
+
@correct = @correct
|
586
|
+
end
|
587
|
+
|
588
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
589
|
+
puts ''
|
590
|
+
|
591
|
+
# question 23
|
592
|
+
|
593
|
+
prompt = TTY::Prompt.new
|
594
|
+
answer = prompt.ask('Top ten pages that Googlebot has hit today')
|
595
|
+
|
596
|
+
if answer == "grep \"Googlebot\" /var/log/nginx/coinrivet.apachestyle.log | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head"
|
597
|
+
puts ''
|
598
|
+
puts ' >> Correct!'
|
599
|
+
puts ''
|
600
|
+
@num_of_q += 1
|
601
|
+
@correct += 1
|
602
|
+
else
|
603
|
+
puts ''
|
604
|
+
puts ' >> Not quite... grep \"Googlebot\" /var/log/nginx/coinrivet.apachestyle.log | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head'
|
605
|
+
puts ''
|
606
|
+
@num_of_q += 1
|
607
|
+
@correct = @correct
|
608
|
+
end
|
609
|
+
|
610
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
611
|
+
puts ''
|
612
|
+
|
613
|
+
# question 24
|
614
|
+
|
615
|
+
prompt = TTY::Prompt.new
|
616
|
+
|
617
|
+
answer = prompt.select('Which type of log will show the user agent?') do |menu|
|
618
|
+
menu.choice 'Nginx'
|
619
|
+
menu.choice 'Apachestyle Nginx'
|
620
|
+
menu.choice 'Apache'
|
621
|
+
end
|
622
|
+
|
623
|
+
if answer == "Apachestyle Nginx"
|
624
|
+
puts ''
|
625
|
+
puts ' >> Correct! Command on what you want to operate on relative to where you are. Interacts with current directory.'
|
626
|
+
puts ''
|
627
|
+
@num_of_q += 1
|
628
|
+
@correct += 1
|
629
|
+
else
|
630
|
+
puts ''
|
631
|
+
puts ' >> Not quite... Apachestyle Nginx'
|
632
|
+
puts ''
|
633
|
+
@num_of_q += 1
|
634
|
+
@correct = @correct
|
635
|
+
end
|
636
|
+
|
637
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
638
|
+
puts ''
|
639
|
+
|
640
|
+
# question 25
|
641
|
+
|
642
|
+
prompt = TTY::Prompt.new
|
643
|
+
answer = prompt.ask('Top Ten pages that had a 504 response code')
|
644
|
+
|
645
|
+
if answer == "grep \"504\" /var/log/nginx/coinrivet.apachestyle.log | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head"
|
646
|
+
puts ''
|
647
|
+
puts ' >> Correct!'
|
648
|
+
puts ''
|
649
|
+
@num_of_q += 1
|
650
|
+
@correct += 1
|
651
|
+
else
|
652
|
+
puts ''
|
653
|
+
puts ' >> Not quite... grep \"504\" /var/log/nginx/coinrivet.apachestyle.log | cut -d\' \' -f7 | sort | uniq -c | sort -rn | head'
|
654
|
+
puts ''
|
655
|
+
@num_of_q += 1
|
656
|
+
@correct = @correct
|
657
|
+
end
|
658
|
+
|
659
|
+
puts " #{@correct} out of #{@num_of_q} questions correct".red
|
660
|
+
puts ''
|
661
|
+
end
|
662
|
+
|
663
|
+
self.questions
|
664
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: l1a_prep
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kyle Crews
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: CLI Quiz to prep for the L1A Assessment
|
14
|
+
email:
|
15
|
+
- dev.kylecrews@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".DS_Store"
|
21
|
+
- ".gitignore"
|
22
|
+
- ".rspec"
|
23
|
+
- ".rubocop.yml"
|
24
|
+
- Gemfile
|
25
|
+
- LICENSE.txt
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- l1a_prep.gemspec
|
29
|
+
- lib/l1a_prep.rb
|
30
|
+
- lib/l1a_prep/l1a-prep.rb
|
31
|
+
- lib/l1a_prep/version.rb
|
32
|
+
homepage: https://github.com/kyle-crews/L1A-Prep
|
33
|
+
licenses:
|
34
|
+
- MIT
|
35
|
+
metadata:
|
36
|
+
homepage_uri: https://github.com/kyle-crews/L1A-Prep
|
37
|
+
source_code_uri: https://github.com/kyle-crews/L1A-Prep
|
38
|
+
changelog_uri: https://github.com/kyle-crews/L1A-Prep
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.4.0
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubygems_version: 3.0.3
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: Simple quiz application to prep for the L1A Assessment
|
58
|
+
test_files: []
|