XpandNotes

exploring the intersection of technology and creativity

LDAP 安裝和設定

此為計算機網路管理課程的 lab11 安裝 參考這篇文章 https://magiclen.org/ubuntu-server-ldap/ 安裝時,照著 ldap 的類 GUI 提示設定 admin 密碼、將 nasa.imslab.org 設為 root dn $ sudo apt install slapd $ sudo dpkg-reconfigure slapd $ sudo...

使用 nginx 與 flask 架設 key-value storage 服務運行於 docker 容器

此為 2021 網路管理課程的 lab14,花了一整晚搞不定 php-fpm 在 docker 寫檔的問題 (已經調整過權限、目錄也 mount 了還是不行) 耗費五到六個小時,後來砍掉重練,改成用 python + redis 的記憶體儲存,兩個小時就幹完了,真是累死人。 以下只有 code,沒力氣打詳細解釋了…,共五個檔案 app.py 1 2 3 4 5 6 7 8 9 10 1...

從 0 開始學習 Docker、Dockerfile、Docker-Compose

1. 安裝 首先使用指令安裝 Docker $ curl -fsSL https://get.docker.com | sudo bash 安裝 Docker Compose $ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(...

DNS 伺服器 bind9 的 zone file 設定

此為計算機網路管理課程的 lab12 設定 named 監聽埠 $ sudo apt install bind9 首先將預設的監聽埠由 53 改為 8053 (lab 要求,一般狀況不需要改監聽埠) $ sudo vim /etc/bind/named.conf.options 在 options{} 區塊裡加入 1 2 3 4 recursion yes; ...

Apache Tomcat 簡易安裝教學

安裝 java 8 $ sudo apt install openjdk-8-jdk 從官網下載 tomcat 的 release 版本,我選用 9.0.46,下載完成後解壓縮 apache-tomcat-9.0.46.tar.gz,然後撰寫一個 setenv.sh 用來存放 tomcat 所需的環境變數。 $ tar -xvf apache-tomcat-9.0.46.tar.gz...

Codility Lesson 3 FrogJmp, PermMissingElem, TapeEquilibrium

FrogJmp A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small frog always jumps ...

Codility Lesson 2 CyclicRotation, OddOccurrencesInArray

CyclicRotation An array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is moved to the first pl...

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 $...