diff --git a/README-zh_CN.md b/README-zh_CN.md index f48608f..878a73a 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -289,7 +289,7 @@
-你是如何实施从某个阶段而不是从最开始构建的选项?
+你是如何实施从某个阶段而不是从最开始构建的选项?
@@ -924,7 +924,7 @@ Zombie(假死态)
-你能解释一下网络进程/连接如何建立以及如何终止?>
+你能解释一下网络进程/连接如何建立以及如何终止?
@@ -1385,6 +1385,7 @@ Terraform与其他工具相比的优势: * Provider * Resource * Provisioner +
@@ -1656,7 +1657,7 @@ Docker Cloud构建在Docker Hub之上,因此Docker Cloud提供了
-解释一下递归 +解释一下递归
@@ -1951,11 +1952,11 @@ with open('file.txt', 'w') as file:
-如何用 "blue" 替换字符串 "green"?
+如何用 "blue" 替换字符串 "green"?
-如何找到一个变量中的所有IP地址? 如何在文件中找到它们?
+如何找到一个变量中的所有IP地址? 如何在文件中找到它们?
@@ -2072,6 +2073,7 @@ def reverse_string(string): * Mergesort * Bucket Sort * Radix Sort +
@@ -2110,7 +2112,7 @@ def reverse_string(string):
-你可以在Python中实现链接链表吗?
+你可以在Python中实现链接链表吗?
@@ -2832,7 +2834,7 @@ where c.Customer_ID in (Select Customer_ID from cat_food);
-详细描述如何使用可以从云外部访问的IP来启动实例
+详细描述如何使用可以从云外部访问的IP来启动实例
diff --git a/scripts/run_ci.sh b/scripts/run_ci.sh index f5a48af..69fddfd 100755 --- a/scripts/run_ci.sh +++ b/scripts/run_ci.sh @@ -1,5 +1,15 @@ #!/bin/bash # These are the same steps we are running in Travis CI -python $(dirname "$0")/../tests/syntax_lint.py + +find . -name "*.md" -not -path "./tests/*" | \ + xargs -I {} \ + python $(dirname "$0")/../tests/syntax_lint.py {} > /dev/null +mdPassed=$? flake8 --max-line-length=100 . && echo "PEP8 Passed" +pyPassed=$? +if [ $pyPassed -eq 0 ] && [ $mdPassed -eq 0 ];then + exit 0 +else + exit 1 +fi diff --git a/tests/syntax_lint.py b/tests/syntax_lint.py index 29713d1..44c80a4 100644 --- a/tests/syntax_lint.py +++ b/tests/syntax_lint.py @@ -11,12 +11,10 @@ $ python tests/syntax_lint.py """ -import pathlib +import sys -p = pathlib.Path(__file__).parent.parent.joinpath('README.md') +p = sys.argv[1] -with open(p, 'rb') as f: - file_list = [line.rstrip() for line in f.readlines()] errors = [] @@ -31,9 +29,9 @@ def count_details(file_list): details_count = 0 for line_number, line in enumerate(file_list): - if b'
' in line: + if b"
" in line: details_count += 1 - if b'
' in line: + if b"
" in line: details_final_count += 1 return details_count == details_final_count @@ -49,9 +47,9 @@ def count_summary(file_list): details_count = 0 for line_number, line in enumerate(file_list): - if b'' in line: + if b"" in line: details_count += 1 - if b'' in line: + if b"" in line: details_final_count += 1 return details_count == details_final_count @@ -70,22 +68,22 @@ def check_details_tag(file_list): after_detail = False error = False - err_message = '' + err_message = "" for line_number, line in enumerate(file_list): - if b'
' in line and b'
' in line: + if b"
" in line and b"
" in line: pass else: - if b'
' in line and after_detail: - err_message = f'Missing closing detail tag round line {line_number - 1}' + if b"
" in line and after_detail: + err_message = f"Missing closing detail tag round line {line_number - 1}" error = True - if b'
' in line and not after_detail: - err_message = f'Missing opening detail tag round line {line_number - 1}' + if b"
" in line and not after_detail: + err_message = f"Missing opening detail tag round line {line_number - 1}" error = True - if b'
' in line: + if b"
" in line: after_detail = True - if b'
' in line and after_detail: + if b"
" in line and after_detail: after_detail = False if error: @@ -107,36 +105,48 @@ def check_summary_tag(file_list): after_summary = False error = False - err_message = '' - for line_number, line in enumerate(file_list): - if b'' in line and b'' in line: - pass - else: - if b'' in line and after_summary: - err_message = f'Missing closing summary tag around line {line_number}' - error = True - if b'' in line and not after_summary: - err_message = f'Missing opening summary tag around line {line_number}' + err_message = "" + for idx, line in enumerate(file_list): + line_number = idx + 1 + if b"" in line and b"" in line: + if after_summary: + err_message = f"Missing closing summary tag around line {line_number}" error = True - if b'' in line: + else: + if b"" in line and after_summary: + err_message = f"Missing closing summary tag around line {line_number}" + error = True + if b"" in line and not after_summary: + err_message = f"Missing opening summary tag around line {line_number}" + error = True + + if b"" in line: after_summary = True - if b'' in line and after_summary: + if b"" in line and after_summary: after_summary = False - if error: - errors.append(err_message) + if error: + errors.append(err_message) error = False -if __name__ == '__main__': +def check_md_file(file_name): + with open(p, "rb") as f: + file_list = [line.rstrip() for line in f.readlines()] check_details_tag(file_list) check_summary_tag(file_list) + + +if __name__ == "__main__": + print(f"..........Checking {p}..........") + check_md_file(p) if errors: + print(f"{p} failed", file=sys.stderr) for error in errors: - print(error) + print(error, file=sys.stderr) exit(1) print("Tests passed successfully.") diff --git a/topics/kubernetes/README.md b/topics/kubernetes/README.md index 03d9014..35c7bab 100644 --- a/topics/kubernetes/README.md +++ b/topics/kubernetes/README.md @@ -2349,14 +2349,7 @@ The pod is automatically assigned with the default service account (in the names ### Patterns -
-Explain the sidecar container pattern
- ion container, there is a sidecar container. -
-r, the application would not exist. In addition to the application container, there is a sidecar container. -In simpler words, when you have a Pod and there is more than one container running in that Pod that supports or complements the application container, it means you use the sidecar pattern. -
### CronJob diff --git a/topics/security/README.md b/topics/security/README.md index 8f33f56..c8984b9 100644 --- a/topics/security/README.md +++ b/topics/security/README.md @@ -253,6 +253,7 @@ True. It is only used during the key exchange algorithm of symmetric encryption. Hashing is a mathematical function for mapping data of arbitrary sizes to fixed-size values. This function produces a "digest" of the data that can be used for verifying that the data has not been modified (amongst other uses) +
How is hashing different from encryption?
Encrypted data can be decrypted to its original value. Hashed data cannot be reversed to view the original data - hashing is a one-way function.