2022年8月13日 星期六
用鄭運鵬換林智堅,真的完全不懂人民在想什麼
人民要的是,知錯能改,換鄭運鵬,這個之前瞎挺的傢伙是要幹嘛?他給我的好感比林智堅更差,林智堅除了抄襲不能錯硬凹讓我反感外,對他也沒什麼特別的討厭,但鄭運鵬這傢伙之前講過的搞笑話實在很多,對他印象實在爛到極點,這民進黨真的跟人民越離越遠
2022年8月11日 星期四
How to install Windows 11 in Paralles on MAC
- Windows 11 需要TPM modules 才能正常安裝使用,
- 在沒有支援TPM的mac 上要使用windows 11 現在可以透過Parallels 上的virtual Trusted Platform Module(TPM)
- 只要在config->Hardward 新增TPM chip 即可,
要是沒有看到,就要先檢查你原本的windows vm 是不是使用Legacy Bios ,因為
TPM只能做用在 UEFI/EFI BIOS, 所以如果是使用 legacy的BIOS目前是會看不到
TPM Chip
- 但支援新的bios 只有新的VM 才有支援。如果是原本舊的VM的話,就可以參考下列我從網路上查到的轉換步驟去自己作轉換
1. 開啟windows vm
細節可以參考這篇wiki Migrating a Windows 10 VM to Windows 11 in Parallels Desktop
2. 輸入 mbr2gpt /validate /allowFullOS
3. mbr2gpt /convert
4. 關閉windows vm
5. 從Mac 開啟VM file , 通常需要點選 "show Package Contents", 找到裡面的config.pvs
6. 使用任何的文字編輯器去編輯檔案
7. 把下列兩行裡面的 0 改成 1
<EfiEnabled> from 0 to 1
<EfiSecureBoot> from 0 to 1
1. 存擋
2. 現在可以從Parallels 開始加入TPM module
原文連結:https://kb.parallels.com/122702
如果還是沒看到TPM選項,就檢查下面開機選項是否有設定vm.efi
Open Parallels
If you have a VM already, shut it down
Open the Virtual Machine’s configuration
Go to Hardware
Go to Boot Order
Go to Advanced Settings
In Boot Flags, type this command:
vm.efi.secureboot=1
蔡英文下令全黨「挺堅」
民進黨這樣跟台大對幹,實在讓我感到很無言,對於之前蔡英文總統的博士學位,我本來還是相信的,現在這樣一搞,我不只對民進黨失望,連帶也會懷疑之前的博士學位事件,難不成真的是有問題,就像高端。講了這麼久。到現在連個認證都沒有。真的是把民眾黨傻子嗎?
2022年8月10日 星期三
林智堅 論文門事件
最近林智堅論文抄襲案,被台大判定抄襲,撤銷碩士學位,但卻看到民進黨全黨相挺,還有幾個以前覺得形象很好很正直的政治人物,例如陳建仁,鄭文燦也是挺到底,就讓我覺得是我的理解真的有問題,還是我真的搞錯這些政治人物,其實他們的形象也是演出來的,其實他們根本就不是那麼正派的政治人物,我真的覺得不要再挑戰普羅大眾的智慧了,學術抄襲這種一翻兩瞪眼的爭議,何必要硬幹到底,不懂這樣做的好處是什麼,測試民進黨的死忠派?過去我追隨的民進黨是有理想的政黨,現在我實在是提到民進黨三個字,就實在支持不下去,搞不懂為什麼民進黨的支持度真的還可以這麼高,真是顛覆我的想像
Netgear RBK 850 wifi connection dropped frequently
My home network encounter the wifi connection dropped issue recently.
I have tried to use Wifi signal analyzer to use specific channel id to avoid conflict with neighbor's wifi AP, but it doesn't work.
Today I found there is a new firmware released, just take a note to record it.
2022年8月8日 星期一
Synology DSM 升級問題
pgsql_analyzer.sh
#!/bin/bash
##################
# Utility functions
##################
syno_getopt()
{
local opt_cmd="$1"
shift 1
while getopts "$opt_cmd" opt; do
if [[ -z "$OPTARG" ]]; then
eval "opt_${opt}"="-"
else
eval "opt_${opt}"="$OPTARG"
fi
done
}
cecho()
{
local color="$1"
local message="$2"
local NC='\033[0m'
local code
case "$color" in
red) code="1;31" ;;
green) code="1;32" ;;
blue) code="1;34" ;;
gray) code="0;37" ;;
yellow) code="1;33" ;;
*) code="1;37" ;;
esac
code='\033['$code'm'
echo "${code}${message}${NC}"
}
errecho()
{
echo -e "$@" >&2
}
LOG()
{
local level="$1"
local message="$2"
local timestamp="$(date +'%Y-%m-%d %H:%M:%S')"
# Echo to screen
local color
case "$level" in
"ERROR"|"WARNING") color="red" ;;
"NOTICE") color="blue" ;;
"INFO") color="green" ;;
*) color="gray" ;;
esac
formatted=$(cecho yellow "$timestamp ")$(cecho $color "[$level] $message")
errecho $formatted
}
log_check_result()
{
local name="$1"
local result="$2"
if [[ "$result" = "true" || "$result" = "0" ]]; then
LOG INFO "Running $name ... Pass"
return 0
else
LOG WARNING "Running $name ... Error found, please check messages above."
return 1
fi
}
db_query()
{
local db="$1"
local sql="$2"
psql -At -F $'\t' -U postgres $db -c "$sql"
}
##################
# Test functions
##################
findfile()
{
local pattern="$1"
local path="$2"
local files="${path} ${path}.1 ${path}.1.xz ${path}.2.xz"
local limit=20
local result=false
local extentsion file msg
for file in $files; do
if [[ ! -f "$file" ]]; then
continue
fi
LOG DEBUG "Searching error message from file: $file ..."
extension="${file##*.}"
case "$extension" in
gz)
msg="$(zcat "$file" | grep "$pattern" | tail -n $limit)"
;;
xz)
msg="$(xzcat "$file" | grep "$pattern" | tail -n $limit)"
;;
*)
msg="$(cat "$file" | grep "$pattern" | tail -n $limit)"
;;
esac
if [[ -n "$msg" ]]; then
result=true
echo "$msg"
break
fi
done
$result && return 0 || return 1
}
has_permission()
{
local path="$1"
local permission="$2"
local user="$3"
local group="$4"
local result=true
local re f_permission f_user f_group
# Check path exists
if [[ ! -e "$path" ]]; then
LOG ERROR "File or directory does not exists: $path"
return 1
fi
# Check path permission
if [[ -n "$permission" ]]; then
re="${permission//-/.}"
f_permission="$(stat -c "%A" "$path")"
if [[ ! "$f_permission" =~ $re ]]; then
LOG ERROR "Permission $permission is not match, path: $path, permission: $f_permission"
result=false
fi
fi
# Check path user
if [[ -n "$user" ]]; then
f_user="$(stat -c "%U" "$path")"
if [[ "$f_user" != "$user" ]]; then
LOG ERROR "User $user is not match, path: $path, user: $f_user"
result=false
fi
fi
# Check path group
if [[ -n "$group" ]]; then
f_group="$(stat -c "%G" "$path")"
if [[ "$f_group" != "$group" ]]; then
LOG ERROR "Group $group is not match, path: $path, user: $f_group"
result=false
fi
fi
$result && return 0 || return 1
}
##################
# Test cases
##################
disklog_check()
{
local files="/var/log/dmesg /var/log/messages"
local result=true
local file
for file in $files; do
if findfile "exception Emask\|status: {\|error: {\|SError: {" "$file"; then
LOG ERROR "Disk error(s) are found in $file"
result=false
fi
done
for file in $files; do
if findfile "EXT4-fs .*: error\|EXT4-fs error\|EXT4-fs warning\|read error corrected" "$file"; then
LOG ERROR "Disk ext-4 error(s) are found in $file"
result=false
fi
done
log_check_result disklog_check $result
}
tune2fs_check()
{
local devs="/dev/md0 /dev/sda1 $(cut -d ' ' -f 1 /run/synostorage/volumetab)"
local result=true
local dev
for dev in $devs; do
if tune2fs -l "$dev" 2> /dev/null | grep "FS Error"; then
LOG ERROR "Filesystem error(s) are found in tune2fs -l $dev"
result=false
fi
done
log_check_result tune2fs_check $result
}
permission_check()
{
# Check directory permission
local volume="$(servicetool --get-service-volume pgsql)"
local result=true
has_permission "$volume" drwxr-xr-x || result=false
has_permission "${volume}/@database" drwxr-xr-x admin users || result=false
has_permission "${volume}/@database/pgsql" drwx------ postgres postgres || result=false
log_check_result permission_check $result
}
user_check()
{
# Check root user name and postgres entry point
local count
local result=true
# Check root name
count=$(cat /etc/passwd | grep -c ':x:0:0:')
if [[ "$count" -ne 1 ]]; then
LOG ERROR "User: root has $count rows in /etc/passwd"
result=false
fi
if ! cat /etc/passwd | grep 'root:x:0:0:' > /dev/null 2>&1; then
LOG ERROR "User: root is not found in /etc/passwd"
result=false
fi
# Check postgres entry point
count=$(cat /etc/passwd | grep -c 'postgres')
if [[ "$count" -ne 1 ]]; then
LOG ERROR "User: postgres has $count rows in /etc/passwd"
result=false
fi
if ! cat /etc/passwd | grep postgres | grep '/var/services/pgsql:/bin/sh' > /dev/nuill 2>&1; then
LOG ERROR "User: postgres entry point(/var/services/pgsql:/bin/sh) has been modified"
result=false
fi
log_check_result user_check $result
}
pglog_check()
{
local result=true
if findfile "FATAL" "/var/log/postgresql.log"; then
LOG ERROR "Fatal error(s) are found in postgresql log"
result=false
fi
log_check_result pglog_check $result
}
volume_check()
{
local volume="$(servicetool --get-service-volume pgsql)"
local result=true
local avail
if ! df -BG | grep -q "$volume"; then
LOG WARNING "Failed to parse volume size, Please check available space of volume manually"
log_check_result volume_check false
return
fi
# Get available volume space in Gigabytes
avail=$(df -BG | grep "$volume" | awk '{print $4}' | sed 's/G//g')
if ((avail <= 1)); then
LOG ERROR "Available volume space is smaller than 1GB"
result=false
fi
log_check_result volume_check $result
}
calendar_check()
{
local result=true
local answer=n
if tail -n 20 /var/log/postgresql.log | grep '/tmp/synocalendar'; then
result=false
read -p "Hit Calendar bug, missing directory: /tmp/synocalendar. Do you want to fix it? (Y/n):" answer
echo ""
if [[ -z "$answer" || "$answer" = "Y" || "$answer" = "y" ]]; then
LOG INFO "Directory created: /tmp/synocalendar. Restart pgsql manullay later ('synoservice --restart pgsql' on DSM6, '/usr/syno/bin/synosystemctl restart pgsql-adapter' on DSM7)."
mkdir /tmp/synocalendar
chown postgres:postgres /tmp/synocalendar
fi
fi
log_check_result calendar_check $result
}
##### Main and help function
rebuild_database()
{
local volume="$(servicetool --get-service-volume pgsql)"
local path="${volume}/@database/pgsql"
local dsm_version=`synogetkeyvalue /etc.defaults/VERSION major`
LOG INFO "Rebuilding database ..."
if [[ "$dsm_version" = "7" ]]; then
if ! /usr/syno/bin/synosystemctl stop-service-by-reason rebuild pgsql-adapter; then
LOG ERROR "Failed to stop pgsql"
return 1
fi
else
if ! synoservice --pause-by-reason pgsql rebuild; then
LOG ERROR "Failed to stop pgsql"
return 1
fi
fi
BACKUP_PATH=${path}-$(date -u +"%Y%m%dT%H%M%SZ")
mv "$path" "$BACKUP_PATH"
LOG INFO "Backup Success: $BACKUP_PATH"
rm /var/services/pgsql
if ! servicetool --set-pgsql; then
LOG ERROR "Failed to create psgql directory"
return 1
fi
if [[ "$dsm_version" = "7" ]]; then
if ! /usr/syno/bin/synosystemctl start-service-by-reason rebuild pgsql-adapter; then
LOG ERROR "Failed to start pgsql"
return 1
fi
else
if ! synoservice --resume-by-reason pgsql rebuild; then
LOG ERROR "Failed to start pgsql"
return 1
fi
fi
LOG INFO "Rebuild done."
}
vacuum_all()
{
local result=true
##### List all databases
dbs="$(db_query postgres 'SELECT datname FROM pg_database WHERE datistemplate = false')"
echo "Database list: $dbs"
##### Vaccum
for db in $dbs; do
# Skip large size database
if [[ "$db" = "synoips" ]]; then
LOG DEBUG "Skip to vacuum $db"
continue
fi
LOG DEBUG "Vacuuming $db"
if ! db_query $db "VACUUM FULL"; then
LOG WARNING "Failed to vacuum $db"
result=false
fi
done
log_check_result vacuum_all $result
}
recreate_database()
{
local package="$1"
local db=$(cat /var/packages/${package}/conf/resource | jq -r '.["pgsql-db"]["create-database"][0]["db-name"]')
local db_tmp="${db}_$(date +'%Y%m%d%H%M%S')"
if ! db_query postgres "ALTER DATABASE $db RENAME TO $db_tmp"; then
LOG ERROR "Failed to rename database from $db to $db_tmp"
return 1
fi
if ! synopkghelper update $package pgsql-db; then
LOG ERROR "Failed to create database for package: $package"
return 1
fi
}
show_usage()
{
cat << EOF
Description:
Analysis pgsql issues
Usage:
$0 [options]
Options:
-h Show this help
-r Rebuild pgsql database
-d <package> Recreate database
-v Vacuum all databases (exluding synoips)
EOF
}
main()
{
syno_getopt "hvrd:" "$@"
shift $((OPTIND-1))
if [[ -n "$opt_h" ]]; then
show_usage
return
fi
##### Rebuild database
if [[ -n "$opt_r" ]]; then
rebuild_database
return $?
fi
##### Vacuum every databases
if [[ -n "$opt_v" ]]; then
vacuum_all
return $?
fi
##### Recreate database for package
if [[ -n "$opt_d" ]]; then
recreate_database "$opt_d"
return $?
fi
##### Check
pglog_check
disklog_check
tune2fs_check
permission_check
user_check
volume_check
calendar_check
}
main "$@"
Obsidian 插件介紹:Text Generator
Text Generator 是 Obsidian 的一個插件,它可以根據給定的提示自動生成文本。這個插件使用 GPT-3 語言模型,能夠產生類似人類的文本,非常適合編寫故事、文章、電子郵件和其他類型文本。 主要功能: **生成文本:**根據提示生成各種長度的...
-
Hard limit: 一般指不管任何狀況下,使用者都不被允許超出使用限制量 Soft limit: 則是允許使用者在一定時間範圍內,可以使用超過使用限制量,之後才會作處理(甚至根本不處理),在軟體功能上,常常會有所謂的paper license 或paper lim...
-
1.從網路上下載文鼎注音字形 201601111329270 2.開啟字體簿 F4 —>其他—>字體簿 3.安裝新的字體 4.開啟word,把要轉換的中文,選好後,選 AR stdKaiZuinn Md 即可
-
前情提要: 2011 mbp 顯卡問題,之前Apple 有召修方案,但目前已經不在召修名單,這個問題是設計上的問題,即使你送給外面的廠商維修,隔了一陣子還是會在故障,我個人的2011 late MBP 筆電已經因為顯卡問題,更換過三次主機板,但目前一樣又出現問題,癥狀就是開機會...