XpandNotes

exploring the intersection of technology and creativity

在 VirtualBox 安裝 Arch Linux

摘要 以下安中步驟主要參考自 youtube,我只是將安裝過程的指令和螢幕截圖下來,如果聽英文沒問題可以直接看影片。對分割、掛載磁碟、設定 Linux 環境很熟悉的人可以直接按照以下摘要的指令安裝: # setfont ter-224b.psf.gz # ping google.com ^C # ls /sys/firmware/efi/efivars # timedatectl set...

Arch Linux 基本設定

終端機字型 在 Arch 官網有一個 Font packages 列表,從中找一個你喜歡的字型,透過 pacman 或 yay 下載,我下載 Terminus。 $ sudo pacman -Syu terminus-font 然後在 /usr/share/kbd/consolefonts/ 就可以發現許多 ter 開頭的字型包,即為剛剛下載的 Terminus 字型。 $ ls ...

用 C++ 實作 Trie

Trie 簡介 Trie,又稱字首樹或字典樹,規則為將單字柴成一個一個字元,每個字元代表一個節點,依照字元在單字中的順序往下長成一棵樹。 Trie 實作方式 首先定義節點物件 node,其必須包含可以往下長的節點 child,在這裡我使用了 STL 的 unordered_map 來實作 child。node 還需要包含一個布林值 is_word 判別從根走到這個節點是否能讀作一個...

Debian 11 筆記

將使用者加入 sudoer 剛安裝好 Debian 時,一定會遇到下 sudo apt ... 卻被告知權限不足的問題,此時必須手動修改 /etc/sudoers 將目前的使用者 (lin) 加入 sudoer。 $ su - # gpasswd -a lin sudo # cd /usr/sbin # ./visudo 此時終端機會用 nano 開啟 sudoer.tmp,將下區塊...

使用 Weasyprint 將 HTML 轉成 PDF

在幫 tldr page 修改 pdf 渲染器時偶然發現 Weasyprint 這個好用的函式庫,以下介紹三種使用方法。首先透過 pip 安裝: $ pip3 install weasyprint 讀取 HTML 檔轉換成自動換頁的 PDF 首先我找了一個 HTML 範例 如下: mystyle.css 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16...

Leetcode #9 Palindrome Number

Description Given an integer x, return true if x is palindrome integer. An integer is a palindrome when it reads the same backward as forward. For example, 121 is palindrome while 123 is not. Ex...

Leetcode #8 String to Integer (atoi)

Description Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++’s atoi function). The algorithm for myAtoi(string s) is as follows: R...

OS 筆記主頁

使用課本: Operating System Concepts 9th Edition 1 Introduction

OS Chapter 1

Introduction

目前普遍的電腦架構如下圖 CPU 不斷地從記憶體吞吐指令,根據指令操作各種 device,device 跳過 CPU,透過 DMA (Direct Memory Access) 主動向記憶體存取資料,增加電腦效率。CPU、記憶體、devices 互相協同工作下,形成了我們日常使用的電腦系統。 多處理器系統 (Multiprocessor systems, parallel syste...

資結筆記主頁

使用課本: Fundamentals of Data Structures in C 2/e 1 Basic Concepts