Skip to content

Instantly share code, notes, and snippets.

HackMD特殊MarkDown語法

這邊要跟大家介紹非常好用功能:內建目錄 打上[TOC]會自動建立目錄

目錄

[TOC]以下為TOC特殊語法 [TOC]

@oneleo
oneleo / README-mainnet.md
Last active January 5, 2023 01:48
ens-offchain-resolver

ENS Offchain Resolver

假設您已從 ens.domains 獲得了一組 ENS(在這裡我們以 token.eth 為例),並且在這之前我們已架設完成了一個 off-chain gateway server。

下面的說明將解釋如何將 off-chain gateway server 與 on-chain token.eth ENS 進行關聯,以便 ethers.js 可以從 off-chain gateway server 成功查詢到對應的 ENS Ethereum 地址。

在本文中,我們假設您已架設好的 off-chain gateway server 資訊及儲存的資料如下:

payload: 0x30875978000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000100000000000000000000000011fe4b6ae13d2a6055c8d9cf65c55bac32b5d844000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da10000000000000000000000002f897200a84478e71fd07a9137ee63a0242092e50000000000000000000000002f897200a84478e71fd07a9137ee63a0242092e50000000000000000000000000000000000000000000000000000000000000064332156fabd471fdd1ae4234d1bd54836b23cd1230a7de51368e07458dc5d85720000000000000000000000000000000000000000000000000000000063a6b90500000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006205970d4da01a0290c88db54c37689143b8f81c51cd4f0049c91440405c3921641402176cfae517252ea86b5080c6e237973d9146ac494
@oneleo
oneleo / gist:ec28bfb312f3f658279e2889bbbd0180
Last active October 12, 2022 07:31
Print Byte32 via Foundry Test
// Reference: https://stackoverflow.com/questions/67893318/solidity-how-to-represent-bytes32-as-string
// Excute: forge test -vvv --match-path "contracts/test/Spender.t.sol" --match-test "testSpendFromUser*"
function testSpendFromUser() public {
bytes32 out1 = keccak256(
abi.encodePacked(
"SpendWithPermit(",
"address tokenAddr,",
"address user,",
"address recipient,",
@oneleo
oneleo / chtti_g217_g313_choco.txt
Last active November 10, 2021 07:49
chtti g217 g313 choco
// https://chocolatey.org/
> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
:: 驅動
> choco install -y vmware-tools
> choco install -y nvidia-display-driver
:: APP 指令程式
{"name":"Cardano ADA Pool","ticker":"ADATW","description":"Cardano ADA Pool","homepage":"https://www.facebook.com/groups/ada.tw"}

下載「未開放下載的 Microsoft Stream 影片」的方法

大多數公司上傳至 Microsoft Stream 的影片會因隱私權政策緣故,除了管理員外禁止下載以防止外流。若僅個人使用或純粹備存用途,可參考下述流程以進行影片備份。

  1. 先使用「管理者權限」開啟 PowerShell,安裝 Chocolatey 後,再透過 Chocolatey 快速安裝必要相依套件。

Chocolatey 官網:https://community.chocolatey.org/

  • 安裝 Chocolatey
@oneleo
oneleo / client.cmd
Last active January 5, 2021 02:03
One-click to Install File Server with disk for Windows
:: Run as administrator through CMD.exe
@echo off
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
netsh advfirewall firewall add rule name="Port 5222" dir=in action=allow protocol=TCP localport=5222 > NUL
netsh advfirewall firewall add rule name="Port 443" dir=in action=allow protocol=TCP localport=443 > NUL
choco install -y googlechrome chrome-remote-desktop-host google-drive-file-stream dontsleep.install > NUL
::"%ProgramFiles%\Google\Chrome\Application\chrome.exe" --new-window --incognito --app="https://remotedesktop.google.com/access"
"%ProgramFiles%\Google\Chrome\Application\chrome.exe" "https://remotedesktop.google.com/access"
"%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe" "https://remotedesktop.google.com/acce
@oneleo
oneleo / installgo_part1.cmd
Last active January 5, 2021 02:05
透過 Chocolatey 安裝 Go 環境
:: Run as administrator through CMD.exe
@echo off
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install -y git.install --params "/NoShellIntegration"
choco install -y vscode golang vscode-go googlechrome chrome-remote-desktop-host dontsleep.install winrar notepadplusplus.install
echo RAR registration data> "C:\Program Files\WinRAR\rarreg.key"
echo yaokai.org>> "C:\Program Files\WinRAR\rarreg.key"
echo Unlimited Company License>> "C:\Program Files\WinRAR\rarreg.key"
echo UID=75ced9c73b51fdd111d1>> "C:\Program Files\WinRAR\rarreg.key"
echo 641221225011d14d1c98ba62a152232016b11806608201f0e0460d>> "C:\Program Files\WinRAR\rarreg.key"