XpandNotes

exploring the intersection of technology and creativity

Codility Lesson 1 BinaryGap

Description A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 ...

使用 nginx 與 php 架設 key-value storage 服務

此為 2021 網路管理課程的 lab7 設定 php-fpm $ sudo apt install php-cli php-fpm 設定 php-fpm 的 port ,設定檔通常在 /etc/php//fpm/pool.d $ sudo vim /etc/php/7.4/fpm/pool.d/www.conf 將 listen 設為 9000 ... ; The add...

Git 筆記

在本地創建一個 branch 並推送到遠端 假設我要新增一個叫 v0.1 的 branch $ git branch v0.1 $ git branch * master v0.1 $ git checkout v0.1 Switched to branch 'v0.1' $ git branch master * v0.1 $ git push -u origin v0.1 $...

解決 VirtualBox 無法自動調整顯示大小

參考資料: https://www.tecmint.com/set-display-screen-resolution-in-ubuntu/ 使用 xrandr 新增自訂義解析度 在終端機使用 xrandr 查看目前有哪些解析度 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30...

Windows EFI、ESP 磁區操作

在刪除 linux 雙系統後,常常會在硬碟中殘留 Windows 用不到的 EFI 分割區,可以用以下方式將其清除。 刪除 EFI 磁區 首先執行 C:\Windows\System32\diskpart.exe 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 DISKPART> list disk 磁碟 ### 狀態 ...

gdisk 新增磁區、mdadm 磁碟陣列、ZFS 設定

此文為計算機系統與網路管理課程 lab4 的實作 gdisk 首先助教分配了 /dev/vdb 和 /dev/vdc 這兩顆磁碟,各自都有 8 GiB 的容量。首先要將它們各自切成 4 GiB 的分割,總共會產生 4 個磁區。 因為我是先做完一次了,所以 gdisk 進入時會偵測到 GPT table 已經存在。如果是完全空的磁碟, gdisk 會在記憶體中先創建一個 GPT tabl...

Leetcode #7 Reverse Integer

Description Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. Assum...

Leetcode #6 ZigZag Conversion

Description The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H ...

Leetcode #96 Unique Binary Search Trees

Description Given an integer n, return the number of structurally unique BST’s (binary search trees) which has exactly n nodes of unique values from 1 to n. Example 1: Input: n = 3 Output: 5 ...

Leetcode #5 Longest Palindromic Substring

Description Given a string s, return the longest palindromic substring in s. Example 1: Input: s = "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: s = "cbbd" Outpu...