分類: 軟體介紹
Micro$oft outlook寄出的檔案常常變成dat, 該如何打開
Gitea(吉茶)認證綁定微軟網域主控站
根據官方文件 , 吉茶可以綁定各式各樣的登入認證, 也包含微軟網域主控認證, 但並沒有解釋太多, 因我有需求要綁定Micro$oft 網域主控站 , 因此記錄一下注意事項.
- 重點在於搞定使用者篩選
# (memberOf=xxx) xxx 為群組名稱 CN=GitGroup,OU=groups,DC=test,DC=com
# 意思就是帳號需隸屬於GitGroup這個群組, 若不需要可以拿掉.
# (mail=*) 代表帳號email屬性必須有值才能用, 若不需要也可以拿掉
(&(objectCategory=Person)(memberOf=CN=GitGroup,OU=groups,DC=test,DC=com)(sAMAccountName=%s)(mail=*)(!(UserAccountControl:1.2.840.113556.1.4.803:=2)))

- 對應帳號屬性與email屬性

- 若匯入的帳號不喜翻, 可以到資料庫刪除, 再執行作業重新匯入
MariaDB [gitea]> delete from email_address where id<>1;
Query OK, 2 rows affected (0.00 sec)
MariaDB [gitea]> delete from user where id<>1;
Query OK, 2 rows affected (0.00 sec)

安裝自己的照片管理軟體-piwigo
這陣子研究清末明初古幣, 於是想起乾脆架設一個照片管理服務器(self hosting), 功能也不用太多, 有hash tag, 搜尋功能也不是很需要, 試用了一款最有名的 https://photoprism.app/ 發現功能太多, 還有AI自動辨識功能, 不符合我的需求.
最後終於找到簡單好用的 https://piwigo.org/ piwigo也有docker版本, 真是太棒了.
我架設了錢幣照片管理網站 - 布書 , 有不輸之意, 布古代為錢之意.

安裝piwigo非常簡單
- 先準備好mysql 這個container, 底下範例,名字叫做 my-mariadb
- 指令如下, 請注意紅色部分需修改
docker volume create piwigo_config
docker volume create piwigo_gallery
docker run -d --restart always --name=piwigo --link my-mariadb:mysql -e PUID=1000 -e PGID=1000 -e TZ=Asia/Taipei -p 2342:80 -v piwigo_config:/config -v piwigo_gallery:/gallery --restart unless-stopped lscr.io/linuxserver/piwigo:12.3.0
- 登入 http://ip:2342
數據庫輸入mysql , 對應到以上指令中的 --link my-mariadb:mysql
再輸入該資料庫的帳號密碼, 以及資料庫名稱(這部分我是先創建好資料庫, 沒試過未創建是否自己建立)
加上 httpd 反向代理, 這樣就大功告成了

更改預設頁面,例如改成tags, docker 進入container, 修改設定檔案
cd /gallery/local/config
vi /gallery/local/config/config.inc.php
############################
$conf['random_index_redirect'] = array(
PHPWG_ROOT_PATH.'tags.php' => 'return true;',
);
############################
2022/10/15
--
piwigo釋出13.0.0 , 我迫不急待進行升級,結果失敗, 原因應該是我使用非官方的docker版本.
最後只能硬著頭皮,
1. 把舊版(12.3.0) piwigo_images 資料表匯出到新版本(13.0.0)去,
2.並且把舊版本/gallery/_data/i 目錄, 以及/gallery/upload 目錄複製到新版本去, 這樣新版本就告訴你有未處裡的照片, 再自己手動重新建立相本吧, 這也是無可奈何的事情, 希望官方能有解決方案.
android kotlin viewBinding 新做法
寫android總是寫不好, 之前取得view要使用findViewByI的方式, 過了一段時間回頭看, 現在又改了改成使用viewBinding 說是比較快...
- gradle(module)
buildFeatures {
viewBinding = true
}
- main activity
class MainActivity : AppCompatActivity() {
lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
}
}
- 使用方式變簡單了
// 舊版
val myButton: Button = findViewById(R.id.my_button)
myButton.text = "A button"
// 新版
val myButton: Button = binding.myButton
myButton.text = "A button"
// Best way with view binding and no extra variable
binding.myButton.text = "A button"

windows 10列出usb連線裝置
我們外接usb裝置, 例如印表機, 讀卡機, 常常讀取失敗,也導致常常要換另外的usb孔測試
因此就需要這個軟體, 列出曾經連線過的usb裝置資訊, 必要時解除安裝其驅動程式,再重新安裝即可
https://www.nirsoft.net/utils/usb_devices_view.html
使用時請務必確認usb裝置未連接到主機
https://www.nirsoft.net/utils/usb_log_view.html
這個網站還有很多奇耙好用的小工具軟體
centos 7 啟用NFS server
真真氣死人, 只是使用restic備份, 需要掛載不同性質的資料來源,
從 rclone 到 sshfs 到回歸nfs server, 只有一種感慨, 就是交給專業的來,不要想東想西的, ssh 來掛載目錄, rclone掛載ssh都不切實際,目前都不穩定.
服務器端啟用nfs server
yum install nfs-utils
## 分享目錄
mkdir -p /mnt/docker
vi etc/exports
=================
#只讀ro, 10.192.130.4可使用
/mnt/docker 10.192.130.4(ro,sync,no_root_squash,no_all_squash)
#讀寫rw, 10.192.130.0/24網段可使用
/mnt/docker 10.192.130.0/24(rw,sync,no_root_squash,no_all_squash)
=================
#啟用
firewall-cmd --zone=public --add-service=nfs --permanent
## rockylinux
#firewall-cmd --add-service={nfs,nfs3,mountd,rpc-bind} --permanent
firewall-cmd --reload
systemctl enable nfs
systemctl start nfs
## rockylinux
#systemctl enable nfs-server rpcbind
#systemctl start nfs-server rpcbind
#查看狀態(windows,linux通用)
showmount -e localhost
用戶端(linux)
mount -t nfs <server ip>:/mnt/docker <本地要掛載的目錄>
或是
mount -t nfs4 <server ip>:/mnt/docker <本地要掛載的目錄>
用戶端(windows)
mount -o anon \\ip\mount_path z:
nextcloud 上查詢支援onlyoffice的版本
https://apps.nextcloud.com/apps/onlyoffice/releases?platform=14
避免與不相容的版本起衝突
目前2022/5/13 我升級到nextcloud 22.2.7 , 但因為docker上面的onlyoffice 最新的是7.1.0,
onlyoffice 只有支援7.2以上才支援 nextcloud 23 , 所以我就無法升級到nextcloud 23囉
nextcloud清除垃圾桶與過多的檔案編輯版本
修改 config.php
過了31天清除
'trashbin_retention_obligation' => 'auto,31',
'versions_retention_obligation' => 'auto,31',
若使用docker安裝, 建議停用容器內建的排程, 改用外面主機, 設定排程自行刪除垃圾桶
docker exec --user www-data <container id> php occ config:app:set --value=no files_trashbin background_job_expire_trash
docker exec --user www-data nextcloud php occ config:app:set --value=no files_versions background_job_expire_versions
docker exec --user www-data <container id> php occ trashbin:expire --quiet

rclone 使用時須注意記憶體
實戰時, 讓restic透過rclone傳輸檔案, 約莫20萬個檔案, 將會導致記憶體不足, 目前看起來應該是--buffer-size需要設定,
已經有人反映,就只能等rclone 更新, 或是GO更新了