[Quest] Python If-Else

Task
Given an integer, , perform the following conditional actions:

  • If n is odd, print Weird
  • If n is even and in the inclusive range of 2 to 5, print Not Weird
  • If n is even and in the inclusive range of 6 to 20, print Weird
  • If n is even and greater than 20, print Not Weird

Input Format

A single line containing a positive integer, n.

Constraints

  • 1 <= n <= 100

Output Format

Print Weird if the number is weird; otherwise, print Not Weird.

Sample Input 0

3

Sample Output 0

Weird

Explanation 0

 n = 3
 n is odd and odd numbers are weird, so we print Weird.

Sample Input 1

24

Sample Output 1

Not Weird

Explanation 1

n =24
n >20 and n is even, so it isn’t weird. Thus, we print Not Weird.

閱讀全文 [Quest] Python If-Else

[Quest] Say “Hello, World!” With Python

Here is a sample line of code that can be executed in Python:

print("Hello, World!")

You can just as easily store a string as a variable and then print it to stdout:

my_string = "Hello, World!"
print(my_string)

The above code will print Hello, World! on your screen. Try it yourself in the editor below!

Input Format

You do not need to read any input in this challenge.

Output Format

Print Hello, World! to stdout.

Sample Output 0

Hello, World!

閱讀全文 [Quest] Say “Hello, World!” With Python

Splunk software

Splunk 一直在 Log Management Tools 上為最佳的系統,只是在 2018 年以前,要取得這個系統相對困難。但是在 2018 年後有了改變,免費版的 Splunk 更易取得,除了有易於推廣以外,也對於 ELK 的崛起做出了反應。不過在聯發科的一年中,學習了這套系統,真的覺得這套有很多神奇的地方,單單使用類似於 SQL 語法的 spl 進行資料搜尋就優於各種 Log 管理工具了。

閱讀全文 Splunk software

output MySQL & MariaDB log

在 MySQL 與 MariaDB 中可以設定輸出 Log 檔案,並且有三種 Log 分別紀錄 error 錯誤訊息,query 資訊,與過於緩慢的 query 資訊。這些資訊有助於我們在管理 MySQL 資料庫,但是因為我想把這些 Log 資訊全部送往 rsyslog,所以必須先將這些資料輸出成檔案,再利用 rsyslog 的轉發功能送到遠端伺服器。

Environment
OS:CentOS 7.5
MariaDB:10.2.17

閱讀全文 output MySQL & MariaDB log

rsyslog with logrotate

之前我們提到了利用 rsyslog 把各地的機器 Log 檔案傳回一台管理機器上,但是這些檔案會越長越大,必須適當的讓檔案定時的刪減,要不然一個檔案包含了 20-30 個月的資料,管理者也沒有辦法輕易的經過調查 Log,因此定時的將資料一份一份的抽離很重要的,尤其是依照時間方式分離,可以很有效的減低日後反查資料的困難度。

Environment
OS:CentOS 7.5
logrotate:3.8.6

閱讀全文 rsyslog with logrotate

Upgrade rsyslog on CentOS

在 CentOS 上,rsyslog 的版本是 8.24,官方說目前最新版本為 8.37,因此可以依照自己的需求進行更新。目前嘗試的結果,8.37 版本的錯誤資訊比較清楚,不確定是我設定上問題還是本來就是這樣。當然我們也只能相信官方會把軟體越修越好,錯誤越來越少。

Environment
OS:CentOS 7.5

閱讀全文 Upgrade rsyslog on CentOS

rsyslog with RELP protocol

rsyslog 是基於 syslog 後衍生出來的新 service,新的系統在支援與設定上都遠優於 syslog,使用更簡單設定,進行大量的模組化修改,增加了彈性與更容易閱讀。這樣的調整讓 Linux 系統家族大量的預設採用 rsyslog,例如在作業系統 CentOS 7.5 已經將 rsyslog 8 版本帶進系統。

Environment
OS:CentOS 7.5
rsyslog:8.24.0
rsyslog-relp:16.el7_5.4

閱讀全文 rsyslog with RELP protocol

Confluence software

在進公司前一直覺得把資料丟到公有雲 Google, Dropbox 是很正常的事情,但是大企業可不這麼想了,把資料丟到公有雲對他們來說不可能發生,也不可能成為選項的選擇。這樣的意識對我來說是很新潮的。不過沒有了這些公有雲服務的支援,公司的人還是要工作,要合作,要想辦法完成交辦任務。這時候 Atlassian 這家公司就成了重要的替代方案。

閱讀全文 Confluence software