[ID]【臺灣ID驗證系列】居留證驗證號

參考網址:辛西亞的技能樹

function verifyId(id) {
    id = id.trim();
    
    <!-- 在 js 中遇到反斜線要跳脫,所以這邊用兩個反斜線 -->
    <!-- 如果你看到四個反斜線,那是我為了讓 NexT.Mist 主題順利渲染所再做跳脫 -->
    verification = id.match("^[A-Z][ABCD]\\d{8}$")
	if(!verification){
		return false
	}

    let conver = "ABCDEFGHJKLMNPQRSTUVXYWZIO"
    let weights = [1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1]

    id = String(conver.indexOf(id[0]) + 10) +  String((conver.indexOf(id[1]) + 10)%10) + id.slice(2);

    checkSum = 0
    for (let i = 0; i < id.length; i++) {
        c = parseInt(id[i])
        w = weights[i]
        checkSum += c * w
    }
	
    return checkSum % 10 == 0
}

console.log(verifyId("FA12345689"));

=========================================
本文作者:辛西亞.Cynthia
本文連結:https://cynthiachuang.github.io/Check-Resident-Certificate-Number/
版權聲明:除非另有標注,部落格中所有文章,均採用 CC BY-NC-SA 4.0 許可協議。 轉載請標明作者、連結與出處!

 

發表於 程式設計 | 發表迴響

一鍵SSD對拷:這種方法無需重灌系統,電腦固態硬碟完美換新

參考網址:https://kknews.cc/zh-tw/digital/25oqg9e.html

用的是ATI2021 Acronis True Image 2021

發表於 軟體使用 | 發表迴響

無線分享器刷 DD-RWT 韌體

參考網址:https://wuangus.cc/dd_wrt/

https://dd-wrt.com/

https://dd-wrt.com/support/router-database/

發表於 硬體維修 | 發表迴響

[jp]日文動詞的記憶秘訣與方法

參考網址:https://colanekojp.com.tw/blog_detail/70

第1類動詞

指的是「〇〇ます」前面的第二個「〇」是「い、き、し、ち、に、び、み、り」的い段音時,就是第1類動詞(有幾個字例外,會歸類為第2類動詞),
例如:

会います、書きます、急ぎます、話します、立ちます、死にます、飛びます 読みます、帰ります。

 


第2類動詞


則是「〇〇ます」前面的第二個「〇」是「え、け、せ、て、ね、べ、め、れ」的え段音,
例如:

考えます、かけます、見せます、建てます、食べます、止めます、入れます

 


第3類動詞


只有兩個,一個是「します」,另一個則是「来ます」,由於「します」也能以「〇〇します」的詞組出現,因此「〇〇します」也會被歸類為第3類動詞,〇〇的位置可以是漢字(通常是2個)、外來語等動作性名詞或擬聲態語,
例如:

〔漢字〕します
勉強します
仕事します

〔外來語〕します
コピーします
キスします

發表於 日語 | 發表迴響

[jp]日本網頁自動注音

參考網址:https://crownfb.pixnet.net/blog/post/39402691

有了這個網頁連結, 日本網頁便會自動加上注音.

https://hiragana.jp/zh-tr/

發表於 日語, 軟體使用 | 發表迴響

[ubuntu]wake on lan設定

參考網址:https://www.itread01.com/content/1547482884.html

登入需要遠端喚醒開機的目標機器,執行ethtool命令檢視網絡卡是否支援Wake On Lan

[root@localhost]# ethtool eth0

看這兩行

Supports Wake-on: pumbg

Wake-on: d

若Wake-on為d,表示禁用Wake On LAN,需要啟用它。

 

[root@localhost]# ethtool -s eth0 wol g

如果已經是g就說明目標機器的網絡卡已經支援Wake On LAN。

 

https://www.itread01.com/content/1550410051.html

當機器重啟後,eth0的設定又會回覆到Wake-on: d 狀態,
這個問題怎麼解決?
兩個辦法:第一個,也是我們的慣性思維;
把/sbin/ethtool -s eth0 wol g 這條命令附加到/etc/rc.local這個檔案中,
則下次開機後會自動執行

第二個: 編輯/etc/sysconfig/network-scripts/ifcfg-eth0
(eth0網絡卡的配置檔案),新增上一行:
ETHTOOL_OPTS=”wol g”

lubuntu 22.04的相關檔案放在/etc/NetworkManager/system-connections
但內容似乎不太一樣
試著在圖形界面修改,在網路連線修改界面中的ethernet頁籤中有個wake-on-lan的選項,
勾選magic後,在該連線檔中
[ethernet]
mac-address-blacklist=
wake-on-lan=64  <<多了這一行

重新開機後查詢網卡狀態,已可以wake-on-lan了

 

TG-3468網卡設定
https://www.tp-link.com/tw/support/download/tg-3468/
 如何消除 TG-3468 的等待畫面 https://www.tp-link.com/tw/support/faq/331/
當電腦一開始啟動並顯示一些基本資訊時,按下 [Shift+F10] ,然後會出現 TG-3468 網路卡的設定功能表

 

小麥部落 linux 使用 wake on lan

https://wiki.debian.org/WakeOnLan#Hardware

 

systemctl  https://necromuralist.github.io/posts/enabling-wake-on-lan/

which ethtool
In my case the path was /sbin/ethtool, so once you know this you can create a file at /etc/systemd/system/wol.service (I think you can use another systemd sub-folder, and you can name the file anything you want, within reason, but this one seems to work well enough). In this file you put settings that look something like this:

[Unit]
Description=Enable Wake On Lan

[Service]
Type=oneshot
ExecStart = /sbin/ethtool --change enp4s0 wol g

[Install]
WantedBy=basic.target
The only thing specific to my machine is enp4s0, the name of the ethernet interface, although it's possible that the path to the ethtool executable might be different too… but it should be the same on Ubuntu 20.10, anyway.

Enable The Service
To enable it you can do this:

sudo systemctl daemon-reload
sudo systemctl enable wol.service
Where wol.service is the name of the file you created with the settings. You can check its status if you want.

systemctl status wol

 

發表於 Linux系統 | 發表迴響

[sublime]開啟BIG5檔案

sublime text 開啟excel 產生的csv檔案時會顯示亂碼,這時可以用File > Reopen with Encoding >BIG5 來解決這個問題
然後再用File > Set File Encoding to > utf8 存成 utf8的檔案格式

BIG5 的編碼在 sublime text 似乎也可以稱為Western(Windows 1252)

發表於 程式設計, 軟體使用 | 發表迴響

[excel]sport寫了兩個巨集,方便編輯賽程表

參考網址:如何在Excel中刪除括號中的內容?

ctrl+m 處理計時決賽(複製本身這一列,然後改成預賽和決賽)
 

Sub a()
'
' 巨集1 巨集
' 將計時決賽分成預賽與決賽
'
' 快速鍵: Ctrl+m
'
    ActiveCell.Rows("1:1").EntireRow.Select
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
    Selection.Copy
    ActiveCell.Offset(-1, 0).Rows("1:1").EntireRow.Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Range("A1").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = ActiveCell.Offset(1, 0).Value & "A"
    ActiveCell.Offset(0, 4).Range("A1").Select
    ActiveCell.FormulaR1C1 = "預賽"
    ActiveCell.Offset(1, 0).Range("A1").Select
    ActiveCell.FormulaR1C1 = "決賽"
    ActiveCell.Offset(1, 0).Range("A1").Select
End Sub

 

ctrl+b 去除混合運動的(1)
 

Sub b()
'
' b 巨集
' 去除混合運動的(1)
'
' 快速鍵: Ctrl+b
'
    Cells.Replace What:="(*)", Replacement:="", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
End Sub

 

發表於 程式設計 | 發表迴響

[php]一個很奇怪的問題

當連結為score_input_new.php?act=edit 傳的參數為edit時,網頁會無法正常運作,以前就沒發現這個問題。

發表於 程式設計 | 發表迴響

[rasp]pi4升級chromium-browser

參考網址:

先移除 apt remove chromium-browser

再安裝 
apt update
apt install chromium-browser

下載:1 http://archive.raspberrypi.org/debian buster/main armhf chromium-browser-l10n all 92.0.4515.98~buster-rpt2 [4,073 kB]
下載:2 http://archive.raspberrypi.org/debian buster/main armhf chromium-browser armhf 92.0.4515.98~buster-rpt2 [118 MB]
下載:3 http://archive.raspberrypi.org/debian buster/main armhf chromium-codecs-ffmpeg-extra armhf 92.0.4515.98~buster-rpt2 [1,589 kB]

 

另一種安裝方式,用snap

https://snapcraft.io/install/chromium/raspbian

On a Raspberry Pi running the latest version of Raspbian snap can be installed directly from the command line:

sudo apt update
sudo apt install snapd

You will also need to reboot your device:

sudo reboot

After this, install the core snap in order to get the latest snapd:

sudo snap install core

Install chromium

To install chromium, simply use the following command:

sudo snap install chromium
發表於 Linux系統 | 發表迴響