Skip to content

Instantly share code, notes, and snippets.

View daoleno's full-sized avatar
🤘
rock & roll

daoleno daoleno

🤘
rock & roll
View GitHub Profile
@daoleno
daoleno / twitter-blur-keywords.md
Last active June 28, 2023 09:58
通过关键字模糊推文
@daoleno
daoleno / uniswapv2.go
Created March 16, 2022 08:18
Generated uniswap v2 code.
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package uniswap
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
@daoleno
daoleno / homebrew
Last active August 14, 2020 14:08
homebrew 国内源
清华源
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
brew update
@daoleno
daoleno / reload-browser.sh
Created November 12, 2019 06:31
reload-browser - A cross-platform wrapper for reloading the current
#!/bin/sh
# reload-browser - A cross-platform wrapper for reloading the current
# browser tab
# Eric Radman, 2014
# http://eradman.com/entrproject/scripts/
usage() {
case `uname` in
Darwin)
# applescript needs the exact title
Client sends HTTP request → Nginx chooses the appropriate handler based on the location config → (if applicable) load-balancer picks a backend server → Handler does its thing and passes each output buffer to the first filter → First filter passes the output to the second filter → second to third → third to fourth → etc. → Final response sent to client

reference

Emiller’s Guide To Nginx Module Development

@daoleno
daoleno / regex.md
Last active August 12, 2018 10:48
some regex

domain

sample.com

^(\*\.)?([a-zA-Z0-9-]+\.){0,5}[a-zA-Z0-9-]+\.[a-zA-Z]{1,63}$

hostname

^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$";
@daoleno
daoleno / EventSourcing.md
Created May 20, 2018 15:10
What is Event Sourcing?
  • Events to provide a history
  • Aggregates to represent the current state of the application
  • Calculator to update the state of the application
  • Reactors to trigger side effects as events happen

img

@daoleno
daoleno / beform_main.md
Created May 14, 2018 01:16
What happens before main() function is executed in C.
  • The hardware is initialized. The most important part of this step is setting up the clock that the CPU needs to run the code. This is usually done by programming a PLL (essentially a programmable clock). If there is not clock going to the CPU, the CPU is essentially dead. The other part of hardware initialization is initializing the interrupt handling hardware.
  • Memory segments are initialized. Memory segments such as .bss (for uninitialized data), .data (for initialized data such as static variables, global variables, local static variables, addresses of functions, and function pointers), and .text (where the actual code resides) are initialized and a valid stack is set up.
  • Command line arguments are received. This may not be relevant in embedded systems as in embedded systems we don’t usually call main() with arguments
  • The stack pointer is configured. This is necessary because the program needs to know where to start from.