12月 02, 2024

開源遠端桌面閘道(Apache Guacamole)

Apache Guacamole

A clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH. We call it clientless because no plugins or client software are required. Guacamole is installed on a server, all you need to access your desktops is a web browser.

遠端桌面閘道(RD Gateway)支援 RDP 及 SSH 協定;使用者透過瀏覽器可直接存取遠端桌面,無需設定。

11月 26, 2024

新眼鏡 2024

新眼鏡給個版面,跟之前框型好像差不多但輕了一些(眼鏡市場, $4500)

9月 18, 2024

自建 Uptime Kuma 監測平台

安裝 Node.js 與 PM2(Process Management)
# apt-get -y update
# apt-get install -y nodejs npm git
# npm install pm2 -g
# pm2 install pm2-logrotate
安裝 Uptime Kuma
# git clone https://github.com/louislam/uptime-kuma.git
# cd uptime-kuma
# npm run setup
# pm2 start server/server.js --name uptime-kuma
進行初次設定 http://localhost:3001

8月 28, 2024

moto g34 5G 手機

小時候認識的摩托羅拉是 Motorola, Inc.,而現在 (2014 起) 則為聯想集團的全資子公司 Motorola Mobility LLC。雖不若以往強盛,但偶有佳作。

Motorola Moto G34

moto g34 5G 規格

  • 處理器 Snapdragon® 695 5G
  • 作業系統 Android™ 14
  • 儲存空間 64GB、記憶體 4GB
  • 螢幕 6.5 吋、重量 179g、電池 5000mAh
  • 具備 NFC、側邊指紋辨識器、3.5mm 耳機孔

聯想並沒投注太多心力在風格打造,手機介面幾乎就是原生安卓 (Stock Android),這點意味能夠體驗精簡設計,用戶依自身需求安裝軟體。相較於 Pixel 手機而言,除了相機平庸之外,其餘 (CPU 與售價) 皆完美。

7月 13, 2024

Cookies Having Independent Partitioned State (CHIPS)

Cookie 分區儲存,第三方 Cookie 只允許讀取同網域下的內容,無法跨站存取。 

Cookies Having Independent Partitioned State (CHIPS) allows developers to opt a cookie into partitioned storage, with separate cookie jars per top-level site, improving user privacy and security.

Without partitioning, third-party cookies can enable services to track users and join their information from across many unrelated top-level sites. This is known as cross-site tracking.

停用方式:

[Chrome]
在 chrome://flags/ 中更改設定 Third-party Storage Partitioning = Disable

[Firefox]
在 about:config 中更改設定 network.cookie.cookieBehavior 改成 4

愈來愈嚴格!

4月 29, 2024

在 GitHub Codespaces 中運行 CodeIgniter v4.5

因為 CodeIgniter v4.5 需要 PHP 8.1 及 PHP-intl 元件才能運作,原生 GitHub Codespaces 運作 Ubuntu 20.04 LTS 版本,快速解法是直接透過 Personal Package Archives(PPA) 補齊新版套件,並把環境鏈結刪除(current),最後再用 composer 把 CodeIgniter 裝起來。

[啟用第三方套件庫]
# add-apt-repository ppa:ondrej/php
# apt install php8.3-{cli,intl,curl,mbstring,mysql,sqlite3,gd} phpunit

[確定當前PHP呼叫路徑]
# which php
# 可能是 /home/codespace/.php/current/bin/php
# 或者是 /usr/local/php/current/bin/php

[重新建立鏈結(current),最新版位於 /usr/bin/php8.3]
# rm /home/codespace/.php/current
# rm /usr/local/php/current
# ln -s /usr /home/codespace/.php/current
# ln -s /usr /usr/local/php/current
# 執行 php --ini 或 php -m 驗證環境

[安裝資料庫]
# apt install mariadb-server
# /etc/init.d/mysql start
# mysql_secure_installation

4月 15, 2024

Redmi Note 13 Pro 5G

Redmi Note 13 Pro 5G ($8,990)

  • 處理器:Qualcomm Snapdragon 7s Gen 2
  • SIM卡:5G + 5G
  • 螢幕:6.67 吋
  • 重量:187g
  • 螢幕指紋辨識、支援 NFC、3.5mm 耳機孔

1月 04, 2024

常用 git 指令與自建 Gitea Server

在 Windows 環境下
  • git 個人設定值存放於 C:\Users\account\.gitconfig
  • ssh 個人公私錀存放於 C:\Users\account\.ssh\
如果要產生公私錀,可以透過 PowerShell 執行 ssh-keygen

初始資訊設定(作者名與郵件)與查看設定值:
git config --global user.name "Foo Bar"
git config --global user.email foo@bar.com

git config --global --list
git config --global --list --show-origin
git 上傳方式有 HTTPS 與 SSH 兩種:

1. 透過 HTTPS 傳輸相對簡單,直接將帳號密碼附在 URL 內即可,但因有密碼外露問題,所以 GitHub 採用 Personal access tokens 作為取代;這是一個短天期的通關碼(token),讓共同參與成員可以對源碼庫進行操作,首次上傳會出現提示要求輸入通關碼
2. 使用 SSH 應當是較為安全的管道,在原始碼上傳前,需預先部署公鑰在遠端伺服器(GitHub或Gitea),本地端推送(PULL)時則出示私鑰進行授權。所以記得使用 ssh-keygen 產生公私鑰放在家目錄 [.ssh] 資料夾。

[HTTPS]
git init
git checkout -b main                                   // 建立並切換到 main 分支
git add .                                              // 加入檔案到 staging
git commit -m "first commit"                           // 加到本地 repository
git remote add origin https://example.com/user/foo.git // git remote add [remote-name] [remote-url]
git push -u origin main                                // 推送本地分支(main)到遠端位址(origin)
[SSH]
git init
git checkout -b main
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:user/foo.git      // 透過 SSH 上傳需佈建公鑰(id_rsa.pub)在遠端
git push -u origin main
[其他常用指令]
git log  // 列出提交歷史
git status  // 列出狀態
git remote -v  // 列出遠端位址
git remote set-url origin   // 更改遠端倉庫位址對應

1月 03, 2024

在 Oracle Cloud 上安裝 Alpine Linux

1. 建立一個以 Ubuntu 為作業系統的虛擬機(當作空殼)

2. 到 Alpine Linux 官網下載 VIRTUAL 版本的映像檔。例如 alpine-virt-3.19.0-x86_64.iso

3. 刷入映像檔

# sudo dd if=alpine-virt-3.19.0-x86_64.iso of=/dev/sda

4. 重新開機

5. 使用 Oracle Cloud 主控台連線(console)操作,進行安裝前準備

# mkdir /media/setup
# cp -a /media/sda/* /media/setup
# mkdir /lib/setup
# cp -a /.modloop/* /lib/setup
# /etc/init.d/modloop stop
# umount /dev/sda
# mv /media/setup/* /media/sda/
# mv /lib/setup/* /.modloop/
6. 循原本方式進行系統安裝(setup-alpine),網路介面直接用 eth0(dhcp)。安裝後驚人的空間使用(僅150MB)

1月 01, 2024

在 Oracle Cloud 建立首個虛擬主機

Oracle Cloud 資安要求嚴謹,首次註冊即強制要求啟動雙因子驗證。每次登入除了帳號密碼外,皆需搭配特定手機軟體(Oracle Mobile Authenticator)方能進入主控台。

主控台最基礎操作就從建立虛擬機(VM compute instance)開始,節點會以用戶的家鄉區(Home Region)作為預設值。基本上 Always Free 方案能選的項目不多,處理器部份固定是 E2.micro 然後作業系統有 Oracle Linux,Ubuntu, CentOS 等。