# DFS&BFS
from collections import deque
class Node:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def dfs(node):
tienyulin changed 2 years agoView mode Like Bookmark
Heroku offers a student program in partnership with GitHub. Students can access Heroku's resources by getting the GitHub Studnet Developer Pack. It provides a credit of $13 USD per month for 12 months. Please follow the instructions below step by step to enable it.
1. GitHub Student Developer Pack
Click here to apply the GitHub Studnet Developer Pack from GitHub Education. An email account from the school, i.e., with .edu, is required to verify your student identity.
2. Heroku for GitHub Students Offer
Register a Heroku account before enrolling in the Heroku Students Offer.
After logging into Heroku, please click here to apply for the Studnets Offer.
tienyulin changed 2 years agoView mode Like 1 Bookmark
act is a tool to run github action locally. By using act, we can get feedback from CI faster. No need to commit/push any changes to github for checking your code is fulfilling the CI requirements or not.
Installation
MacOS
Using homebrew to install act
brew install act
Install Docker
tienyulin changed 2 years agoView mode Like Bookmark

上一篇有提到 SSH 可以在使用者和客戶端之間建立一條安全的隧道 (tunnel) 來進行資料的傳輸,或者是存取到特定的服務。透過 SSH Tunnel 可以達到傳輸的加密或是網路和防火牆的穿透。
舉例來說,我有一台電腦 A 不能對外連線,有一台伺服器 B 可以對外連線,而電腦 A 是可以連線到伺服器 B 的,這時就可以在 A 和 B 之間建立 Tunnel 並將 A 要做的事情轉傳給 B,讓 B 幫忙連到外網完成。這樣的概念類似於 Port Forwarding 或是 Proxy。
SSH Tunnel 可以分為以下幾種 :
Local Tunnel (Local Forwarding)
Remote Tunnel (Remote Forwarding)
tienyulin changed 4 years agoView mode Like Bookmark
上一篇 我們介紹了如何建立最基本的 Pod 和連線到應用的方式,然而這樣的建立方式是無法滿足實際應用中的需求的。實際應用上會有多伺服器運行同個應用、伺服器故障需要故障轉移等等的問題,因此 Kubernetes 提供了一些 Pod 的進階功能,如下 :
Service
Deployment
Ingress
Service
Service 是一個抽象化的物件,它定義了一群的 Pod 和存取這些 Pod 的規則。簡單來說就是要讓使用者和 Kubernetes Cluster 進行隔離,使用者只需要告訴 Service 我的請求而不需要知道誰會幫我處理也不需要知道處理的過程和細節,Service 收到請求後就會依照定義的規則將請求送到對應的 Pod。
Pod 和 Pod 之間的也會透過 Service 來存取。
tienyulin changed 4 years agoView mode Like 1 Bookmark
在 Linux (一) - 基本概念與系統操作 有提到,Linux 支援多使用者同時進行操作。多個使用者可以同時進行操作雖然是非常方便,但是卻也因此衍生出了檔案權限的安全性問題。所以 Linux 系統對於不同使用者要存取相同的檔案或目錄都有不同的權限設定。
檔案屬性
上一篇 我們有介紹過了 ls 指令可以列出目錄下的檔案和目錄,這裡我們要在使用 ls -l 列出檔案的詳細資訊來查看檔案的屬性。如下 :
$ ls -l
total 56
-rw-r--r-- 1 root root 12148 Aug 9 21:39 anaconda-post.log
lrwxrwxrwx 1 root root 7 Aug 9 21:38 bin -> usr/bin
tienyulin changed 4 years agoView mode Like Bookmark
不同於 Windows 將文件依照硬碟存放在 C 槽、 D 槽等等,Linux 將整個文件系統視為一棵樹,樹根稱為根目錄 ( / ),文件會從根目錄開始以樹狀結構排序,如上圖。而硬碟則是透過掛載 (Mount) 的方式來接上檔案系統再進行存取。
根目錄下的目錄有很多,本文僅介紹常用的目錄。
基本檔案目錄操作
在開始介紹每個目錄的意義之前,我們要先簡單的了解如何操作這些目錄和檔案。
ls
列出文件可以使用 ls 這個指令。
tienyulin changed 4 years agoView mode Like Bookmark
Kubernetes 又稱 K8s,是一個容器叢集管理系統,可以自動化的部署及管理多台機器上的多個容器。
容器建構在最底層的作業系統 Linux 之上,而 Kubernetes 又建構在容器之上。也因此為這些容器提供管理的功能。
Kubernetes官網對於Kubernetes的服務描述為 :
Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.
這段描述說明了他的主要功能 :
tienyulin changed 5 years agoView mode Like Bookmark