Skip to content

Zeroplex 生活隨筆

軟體開發、伺服器和生活瑣事

小 縮小字型大小。 中 重設字型大小。 大 放大字型大小。

年份: 2020 年

Live USB 救援用可開機隨身碟

Posted on 2020 年 7 月 24 日2021 年 3 月 12 日 By 日落 在〈Live USB 救援用可開機隨身碟〉中尚無留言

之前做的 ISO 都沒人用,測試了一下才知道不會自動登入,也忘記設定帳號密碼,實在蠢死了。

這次更新用 Ubuntu-Mate 20.04 來建置,應該可以支援較多的驅動程式,希望可以在急需時幫上忙。

載點:

  • MEGA:live-usb-rescue-20200723-amd64.iso  (2.26GB)
  • MD5:a73889f844472acc8c2b2f1f0eb5ffe2
  • SHA1:1A4C09A642F2FA71230F4758CACDB6CCBDA80871

理論上這個版本會自動登入,若沒有成功,可以使用:
  • 帳號:root
  • 密碼:toor
推薦使用 balenaEtcher 或 Universal USB installer 來建立開機隨身碟。
Tags:Linux

用 Nginx 設定擋掉特定的 user agent

Posted on 2020 年 6 月 21 日2021 年 6 月 25 日 By 日落 在〈用 Nginx 設定擋掉特定的 user agent〉中尚無留言

有些 bot 很討厭,掃描速度快,而且感覺在猜測網站內容,打出很多 HTTP 404:

$ grep bot access.log | awk '{print $NF}' |sort | uniq -c | sort -n | tail
    298 +http://napoveda.seznam.cz/en/seznambot-intro/)"
    525 +http://www.brandwatch.net)"
    599 +http://yandex.com/bots)"
   1005 bot@linguee.com)"
   1233 Safari/537.36"
   1421 +http://www.bing.com/bingbot.htm)"
   5335 +https://seostar.co/robot/)"
  48104 +http://www.semrush.com/bot.html)"
  81520 +http://www.google.com/bot.html)"
  93660 +http://ahrefs.com/robot/)"

參考了別人 $http_user_agent 的處理方法:

if ($http_user_agent ~* (AhrefsBot|SemrushBot)) {
    return 444;
}

另外要注意的是:

  • ~*:這個不分大小寫 (case insensitive)
  • ~:這個會區分大小寫

ps. 一般來說可以參考 HTTP status code 給 HTTP 403、444 等狀態碼,我是不爽所以給 HTTP 418

Tags:Nginx

MySQL 5.7 安裝以後無法用 root 登入

Posted on 2020 年 6 月 10 日2021 年 3 月 12 日 By 日落 在〈MySQL 5.7 安裝以後無法用 root 登入〉中尚無留言

以往都是在安裝的時候,直接請你先填寫 root 密碼,以便安裝完畢以後直接登入。
但 MySQL 5.7 認證方式有更改,即使是 root 也沒有給你預設密碼。

新的方法要使用 OS 的 root 來登入 MySQL:

$ sudo mysql -u root
....
....
....
mysql>

建立 super user 帳號:

create user zeroplex@localhost identified by 'secret';
flush privileges;

grant all privileges on *.* to zeroplex@localhost with grant option;
flush privileges;

到這邊告一段落,之後 zeroplex@localhost 就可以使用原有的方式登入了。

Tags:Linux, MySQL

Pytrhon 檢查語法是否正確的方式

Posted on 2020 年 6 月 2 日2021 年 3 月 12 日 By 日落 在〈Pytrhon 檢查語法是否正確的方式〉中尚無留言

如果是用 python 直接跑:

python3 views.py
Traceback (most recent call last):
  File "views.py", line 1, in <module>
    from django.shortcuts import render

python 執行了程式,發現 import 或是程式有用到外部 library 而導致噴錯。 

 如果只要檢查語法是否正確,需要靠 py_compile module:

python3 -m py_compile views.py
Tags:Python, 程式設計

Virtualized performance counters are not support on the host CPU type: Module VPMC power on failed

Posted on 2020 年 5 月 25 日2021 年 3 月 12 日 By 日落 在〈Virtualized performance counters are not support on the host CPU type: Module VPMC power on failed〉中尚無留言

Seems VPMC is a profiling tools seens 2015.  But I do not really care what is using for.

There are two ways to disable VPMC :

  • Disable from VM settings
  • Edit VMX file using an editor
Open the VM settings, and switch to Processors page.
The second option is “VPMC”
in a little geek way, open the VMX file by any editor you want, and search the keyword “VPMC” :
Find it, and change it to “FALSE”
Happy Hacking !
Tags:VMware

文章分頁

上一頁 1 2 3 ... 5 下一頁

其他

關於我  (About me)

  文章 RSS Feed

  留言 RSS Feed

Apache AWS Bash C/C++ Docker FreeBSD GCP Git Google Java JavaScript Laravel Linux Microsoft MSSQL MySQL Nginx PHP PHPUnit PostgreSQL Python Qt Ubuntu Unix Vim Web Windows WordPress XD 作業系統 分享 好站推薦 專題 攝影 新奇搞笑 新聞 旅遊 生活雜記 程式設計 網路架站 網頁設計 資訊學習 資訊安全 遊戲 音樂


創用 CC 授權條款
本著作係採用創用 CC 姓名標示-相同方式分享 4.0 國際 授權條款授權.