黃國豪

@dmefs

- Golang developer - Backend Engineer - Looking for opportunerties

Joined on Aug 24, 2020

  • 最近 SQL 有儲存 IP 的需求,使用的是 cockroachDB,由於 protocol 跟 postgreSQL 一樣,所以先從 PG 著手,會發現有 inet 跟 cidr 可以使用,而在 golang 裡要如何使用 inet 與 cidr 呢?這個留到後面再煩惱,先把連線建立起來。 那就來試試吧,先啟動一個 CRDB,為了方便沒有使用憑證 $ cockroach start-single-node \ --insecure \ --listen-addr=localhost:26257 \ --http-addr=localhost:8083 啟動後可以看到連線資訊 postgresql:... 記起來等一下連線可以使用
     Like  Bookmark
  • 紀錄走過的點點滴滴 Golang Context deadline exceeded DNS bind9 6.1810 meetup
     Like  Bookmark
  • 首先定義一個 shared_ptr<int> p1 接著宣告另一個 shared_ptr<const int> p2 並指向 p1 分別把值印出來 #include <iostream> #include <memory> int main() { std::shared_ptr<int> p1 = std::make_shared<int>(3); std::shared_ptr<const int> p2 = p1;
     Like  Bookmark
  • 想要了解 dig 是如何運作的,所以下載了 dig source code 查看了一下目前使用的版本 $ dig -v DiG 9.18.25 把下載後的版本設為 9.18.25 $ cd bind9 $ git checkout v9.18.25 接著根據文件 doc/arm/build.inc.rst開始編譯,為了要 debug 需要 -g
     Like  Bookmark
  • context 提供連線中斷的機制,其中 WithTimeout 可以設定 timeout。 如果共用 context 會導致 timeout 的時間被佔用而提早結束連線。 go playground package main import ( "context" "fmt"
     Like  Bookmark
  • 1802. Maximum Value at a Given Index in a Bounded Array 看不出來解答為什麼這麼寫 func maxValue(n int, index int, maxSum int) int { return sort.Search(maxSum, func(t int) bool { s := t*t if a := t - index; a > 1 { s -= (a - 1) * a / 2 } if b := t - (n - 1 - index); b > 1 {
     Like  Bookmark
  • Remove Duplicates from Sorted Array II func removeDuplicates(nums []int) int { l := len(nums) if l < 2 { return len(nums) } idx := 2 for i := 2; i < len(nums); i++ {
     Like  Bookmark
  • previous 建議他去讀點書 4/24 我有聽沒有懂 我要先離開了 4/25 好拉開始
     Like  Bookmark
  • Install Falied to install cntext with Python3.11 目前 Python3.11 無法安裝 cntext,只支援到 Python3.8,可以使用venv建立虛擬環境使用 Install venv for Python3.8 首先要先安裝 Python3.8 Ubuntu 20.04 $ sudo apt install python3.8 python3.8-venv
     Like  Bookmark
  • Mac OS install RISC-V compiler toolchain issue 使用 Mac OS 安裝 RISC-V toolchain 時會有問題 執行 $ brew tap riscv-software-src/riscv $ brew install riscv-gnu-toolchain 會有問題 原因是有兩個 submodule 名稱更改了,
     Like 1 Bookmark
  • lab 本次作業實做 Copy-on-Write Fork, 使用 RISC-V PTE 的 RSW bit 當作 page 是否為 cow 的依據 # kernel/riscv.h define PTE_COW (1L << 8) // cow PTE fork() 透過 uvmcopy() 複製 parent 的 pagetable,
     Like  Bookmark
  • RISC-V assembly Q1 Which registers contain arguments to functions? For example, which register holds 13 in main's call to printf? user/call.asm void main(void) { 1c: 1141 addi sp,sp,-16 1e: e406 sd ra,8(sp)
     Like  Bookmark
  • Schedule 依照進度 授課影片請參考2021 Discord Host :::info Host's job 整理 lab 整理課程內容
     Like 2 Bookmark
  • 使用 VSCode 搭配 xv6 qemu-gdb VSCode launch.json 首先在 VSCode 新增一個 launch.json "configurations": [ { "name": "(lldb) Attach", "type": "cppdbg", "request": "launch", "MIMode": "gdb",
     Like  Bookmark
  • Speed up system calls diff --git a/kernel/proc.c b/kernel/proc.c index 959b778..72068b2 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -132,6 +132,13 @@ found: return 0; } + // Allocate a usyscall page.
     Like  Bookmark
  • Setup env 以 mac m1 為例,首先安裝開發者工具 $ xcode-select --install 接著安裝 homebrew,package manager $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 接著安裝 riscv tool chain $ brew tap riscv/riscv
     Like 1 Bookmark
  • Todo [ ] KMP Algorithm 4/15 Leetcode 28 strStr
     Like  Bookmark
  • Authors 資工碩二 黃國豪 109598074 資工碩二 吳承岳 109598085 共同開發 About 本次作業設計一個支援部分語法的 c 語言 Scanner 參考 c4 使用 flex 作為開發工具 測試檔案為 hello.c
     Like  Bookmark
  • ref: https://github.com/brendangregg/bpf-perf-tools-book 本篇紀錄閱讀 bpf-perf-tools-book 心得 BCC & bpftrace ref: https://github.com/iovisor/bcc https://github.com/iovisor/bpftrace 簡介 BPF 分為兩大主軸: BCC & Bpftrace
     Like  Bookmark
  • contributed by < dmefs > 環境: windows 10 使用 multipass ,透過 vscode ssh 連到 vm 寫程式 $ uname -r 5.4.0-80-generic $ multipass list Name State IPv4 Image hideproc Running 172.24.248.146 Ubuntu 20.04 LTS $ multipass shell hideproc
     Like  Bookmark