2021年4月19日 星期一

CentOS upgrade GCC

使用 SCL 安裝方式,它不會取代原本系統的 gcc ,是透過 sch enable 進行切換,相對比較安全

以 gcc 9 為例:
yum -y install centos-release-scl-rh
yum -y install devtoolset-9-toolchain.x86_64

# which gcc
/usr/bin/gcc
# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

切換到 gcc 9 的環境

# scl enable devtoolset-9 bash
# which gcc
/opt/rh/devtoolset-9/root/usr/bin/gcc
# gcc --version
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2021年4月7日 星期三

data URI

data URI 可以將影像,檔案等以 base64 編碼內嵌至網頁內,可以減少瀏覽器發出 Request 的次數

data URI 的表達式如下:
data:[<mediatype>][;base64],<data>

img 使用 data URI 是最常見的模式,例如上面這張 Hello World 圖片(Blogger 預設的附圖就是 data URI)

a link 加上 download="filename" 就可以用 data URI 直接下載檔案

例:

Download PNG (上面那張 Hello Word 圖檔)

Download TXT

實測 JS、CSS 的引入檔也可以用 data URI,但似乎未曾看過有人這樣做,猜測可能是不好管理。
現今瀏覽器多執行緒的優化,使用 data URI 可能不見得比較快了

ESXi find what process lock file

ESXi 檔案刪不掉,出現 Device or resource busy 若檔案名稱是 windows-10-flat.vmdk 下此指令就可以知道那邊佔用 ps | grep `lsof | awk '/windows-10-flat.vmdk/ {print $1...