rocky 8.6 install anydesk

vi /etc/gdm/custom.conf

[daemon]
WaylandEnable=flase
AutomaticLoginEnable=true
AutomaticLogin=$USERNAME

發表於 未分類 | 發表迴響

win10 印表機修復不能

cmd 系統管理員等級
sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth

發表於 windows | 發表迴響

docker: ubuntu 新增網路指令

apt-get update
#舊的
apt install net-tools iputils-ping ssh-tools inetutils-ping
#新的
apt install net-tools iputils-ping ssh-tools ipoute2

發表於 docker | 發表迴響

lvm extand

新增 /dev/sdb
fdisk /dev/sdb
n /dev/sdb1
lvm_id:8e

接下來新增至 (注意:新增硬碟擴充,類似raid0 有風險)
vgextend pve /dev/sdb1
lvextend /dev/pve/data /dev/sdb1
resize2fs /dev/pve/data

發表於 linux, 未分類 | 發表迴響

Win11 安裝強制連線

shift + F10 叫出工作管理員, 輸入 taskmgr
關閉 網路連線 就可

發表於 windows | 發表迴響

python 確認檔案和目錄

# python os.path.isfile() os.path.isdir() os.path.exists()
#https://shengyu7697.github.io/python-os-path-isdir/
#https://shengyu7697.github.io/python-os-path-isfile/

import os
dir="ppp"
print("—–確認目錄開始——")
#print(os.path.isdir(dir))
print ("os.path.isdir(範例)")
checkdir=os.path.isdir(dir)
if checkdir:
print("目錄存在")
else:
print("目錄不存在")

print ("os.path.exists(範例)")
checkdir=os.path.exists(dir)
if checkdir:
print("目錄存在")
else:
print("目錄不存在")

#確認檔案開始
print("—–確認檔案開始——")
print ("os.path.isfile(範例)")
files="jjj.txt"
checkfile=os.path.isfile(files)
if checkfile:
print("檔案存在")
else:
print("檔案不存在")

print ("os.path.exits(範例)")
files="jjj.txt"
checkfile=os.path.exists(files)
if checkfile:
print("檔案存在")
else:
print("檔案不存在")

發表於 python | 發表迴響

python 安裝 pip.py

python 安裝時 勾選 add all users path
path 記得選擇 c:\Python310\ 並加入 c:\Python310\ 和 c:\Python310\scripts
下載 https://bootstrap.pypa.io/get-pip.py
python get-pip.py

參考:

https://www.maxlist.xyz/2019/07/13/pip-install-python/

發表於 python | 發表迴響

python: json 檔案處理

#file.py
import json as j
with open("config.json", mode="r", encoding="utf-8″) as f:
data=j.load(f)
print(data) #data 是一個字典
print ("name" + " :", data["name"])
print ("version" + " :", data["version"])

#修改寫入
data["name"]="New Name"
with open("config.json", mode="w", encoding="utf-8″)as f:
j.dump(data, f)

#在讀取
with open("config.json", mode="r", encoding="utf-8″) as f:
data=j.load(f)
print(data) #data 是一個字典
print ("name" + " :", data["name"])
print ("version" + " :", data["version"])

發表於 python | 發表迴響

mis 工程師 好用等寬字型

https://www.jetbrains.com/lp/mono/

發表於 未分類 | 發表迴響

python: File 處理

#file.py
with open("test.txt", mode="w", encoding="utf-8″) as file:
file.write("測試中文")

#如果檔案為utf8時,檔案第一列會有一個字元BOM,python encodeing=utf-8 列印時會有"\ufeff"輸出
# ,encoding 改為 utf-8-sig 讀取時會 去除 檔案抬頭 的 BOM
with open("test.txt", mode="r", encoding="utf-8-sig") as file:
data=file.read(2)
print(data)

發表於 python | 發表迴響