From: AceVest Date: Mon, 23 Dec 2019 02:26:28 +0000 (+0800) Subject: add zshrc X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=e1c7a57b93a021213d87d797f1dd4f135c89f932;p=acecode.git add zshrc --- diff --git a/learn/arduino/hardware/ace/avr/cores/avr/AceAvr.h b/learn/arduino/hardware/ace/avr/cores/avr/AceAvr.h index 5bae26b..f2ba202 100644 --- a/learn/arduino/hardware/ace/avr/cores/avr/AceAvr.h +++ b/learn/arduino/hardware/ace/avr/cores/avr/AceAvr.h @@ -38,6 +38,7 @@ void acevest(); #define PORTD _SFR_IO8(0x0B) #define SREG _SFR_IO8(0x3F) + // F_CPU 定义在命令行中 #ifndef F_CPU #error "did not define F_CPU" diff --git a/learn/arduino/hardware/ace/avr/cores/avr/kernel.cpp b/learn/arduino/hardware/ace/avr/cores/avr/kernel.cpp index eaa37d8..83a6875 100644 --- a/learn/arduino/hardware/ace/avr/cores/avr/kernel.cpp +++ b/learn/arduino/hardware/ace/avr/cores/avr/kernel.cpp @@ -107,6 +107,10 @@ void create_task(void (*handler)(), uint8_t *stack, uint8_t priority) *(--(t->stack)) = 0x00; } +void fuck() { + SP = 0xAC; +} + void task_switch(struct task *prev, struct task *next) { if(prev == next) { return; diff --git a/learn/doc/zshrc b/learn/doc/zshrc index 14e93f2..edb1820 100644 --- a/learn/doc/zshrc +++ b/learn/doc/zshrc @@ -1,3 +1,136 @@ -# for mac zsh -alias ls='ls -G' -alias ll='ls -l -G' +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="/Users/ace/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +#ZSH_THEME="robbyrussell" + +# 需要安装字体: https://github.com/powerline/fonts.git +# 字体安装之后,需要将终端的字体设置为‘Roboto Mono for Powerline +ZSH_THEME="agnoster" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS=true + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in ~/.oh-my-zsh/plugins/* +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +# 自动补全插件: https://mimosa-pudica.net/src/incr-0.2.zsh +# 将incr-0.2.zsh保存到~/.oh-my-zsh/custom/plugins/incr/并重命名为incr.plugin.zsh +plugins=( + git + incr +) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +export PATH=/usr/local/sbin:$PATH +export PATH=$HOME/.local/bin:$PATH +export PATH=$PATH:$HOME/workspace/esp/xtensa-esp32-elf/bin +export PATH=$PATH:$HOME/workspace/esp/xtensa-lx106-elf/bin +export IDF_PATH=$HOME/workspace/esp/esp-idf +#export IDF_PATH=$HOME/workspace/esp/ESP8266_RTOS_SDK +export PATH=$PATH:/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/ +export PATH=$PATH:$HOME/Library/Arduino15/packages/arduino/tools/avrdude/6.0.1-arduino5/bin +export PATH=$PATH:/usr/local/opt/go/libexec/bin +export PATH=$PATH:/Users/ace/sys/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.2-20190521-0004/bin +#多个GOPATH用';'分隔 go get会存到第一个目录 +export GOPATH=$HOME/workspace/go:$HOME/workspace/web/qossvr/ +export RTOS_PATH=$HOME/workspace/acecode/rtos/ + +export PATH=/usr/local/sbin:$PATH +export PATH=$HOME/.local/bin:$PATH +export PATH=$PATH:$HOME/workspace/esp/xtensa-esp32-elf/bin +export PATH=$PATH:$HOME/workspace/esp/xtensa-lx106-elf/bin +#export IDF_PATH=$HOME/workspace/esp/esp-idf +export IDF_PATH=$HOME/workspace/esp/ESP8266_RTOS_SDK +export PATH=$PATH:/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/ +export PATH=$PATH:$HOME/Library/Arduino15/packages/arduino/tools/avrdude/6.0.1-arduino5/bin +export PATH=$PATH:/usr/local/opt/go/libexec/bin +export PATH=$PATH:/Users/ace/sys/gnu-mcu-eclipse/riscv-none-gcc/8.2.0-2.2-20190521-0004/bin +#多个GOPATH用';'分隔 go get会存到第一个目录 +export GOPATH=$HOME/workspace/go:$HOME/workspace/web/qossvr/ +export RTOS_PATH=$HOME/workspace/acecode/rtos/ diff --git a/tools/game/ksp_planet_transfer_calculator.go b/tools/game/ksp_planet_transfer_calculator.go index fce6ba9..3b79a5b 100644 --- a/tools/game/ksp_planet_transfer_calculator.go +++ b/tools/game/ksp_planet_transfer_calculator.go @@ -7,24 +7,25 @@ * ------------------------------------------------------------------------ */ package main + import ( "fmt" "math" ) type AstronomicalObject struct { - name string - parent string - radius float64 // 天体半径 - sma float64 // Semi-major axis 轨道半长轴 - inclination float64 // 轨道倾角 - eccentricity float64 // 轨道偏心率,没有使用 - u float64 // 标准重力参数 u = GM, F=(G*M*m)/(r^2) - soi float64 // Sphere of influence 势国作用范围 + name string + parent string + radius float64 // 天体半径 + sma float64 // Semi-major axis 轨道半长轴 + inclination float64 // 轨道倾角 + eccentricity float64 // 轨道偏心率,没有使用 + u float64 // 标准重力参数 u = GM, F=(G*M*m)/(r^2) + soi float64 // Sphere of influence 势国作用范围 } -var objects = map[string]AstronomicalObject { - "Kerbol" : { +var objects = map[string]AstronomicalObject{ + "Kerbol": { "Kerbol", "", 261600000, @@ -32,21 +33,19 @@ var objects = map[string]AstronomicalObject { 0, 0, 1.1723328e18, - math.MaxFloat64, // 应该是infinity + math.MaxFloat64, // 应该是infinity + }, + "Eve": { + "Eve", + "Kerbol", + 700000, + 9832684544, + 2.1, + 0.01, + 8.1717302E12, + 85109365, }, - "Eve" : - { - "Eve", - "Kerbol", - 700000, - 9832684544, - 2.1, - 0.01, - 8.1717302E12, - 85109365, - }, - "Duna" : - { + "Duna": { "Duna", "Kerbol", 320000, @@ -56,8 +55,7 @@ var objects = map[string]AstronomicalObject { 3.0136321e11, 47921949, }, - "Kerbin" : - { + "Kerbin": { "Kerbin", "Kerbol", 600000, @@ -67,27 +65,25 @@ var objects = map[string]AstronomicalObject { 3.5315984e12, 84159271, }, - "Dress" : - { - "Dress", - "Kerbol", - 138000, - 40839348203, - 5, - 0.145, - 2.1484489e10, - 32832840, - }, + "Dress": { + "Dress", + "Kerbol", + 138000, + 40839348203, + 5, + 0.145, + 2.1484489e10, + 32832840, + }, } func getAstronomicalObjectOrbitalPeriod(sma float64, u float64) float64 { - return 2*math.Pi*math.Sqrt(math.Pow(sma, 3) / u) + return 2 * math.Pi * math.Sqrt(math.Pow(sma, 3)/u) } func main() { defer fmt.Println("Program Exited...") - // 轨道周期的计算公式为 T=2*Pi*sqrt(sma^3/u) // 设源和目标轨道半轴长分别为Rs, Rd // 则转移轨道周期为 Tt = 2*Pi*sqrt(((Rs+Rd)/2)^3/u) @@ -96,12 +92,12 @@ func main() { // 则有 t*Wt = Pi ===> t = Tt*Pi // 则有 Wd*t + PhaseAngle = Pi (即经过t时间目标+相位角=霍曼转移经过Pi弧度后会合) // ===> (1/Td)*Tt*Pi + PhaseAngle = Pi - // ===> PhaseAngle = Pi - Tt*Pi/Td + // ===> PhaseAngle = Pi - Tt*Pi/Td aos := objects["Kerbin"] aod := objects["Duna"] if aos.parent != aod.parent || aos.parent == "" || aod.parent == "" { - fmt.Println("invalid astronomical object"); + fmt.Println("invalid astronomical object") return } @@ -113,5 +109,5 @@ func main() { PhaseAngle := math.Pi - Tt*math.Pi/Td fmt.Printf("%.6f %.6f\n", Ts, Td) - fmt.Printf("phase angle %.2f°\n", PhaseAngle*180/math.Pi); + fmt.Printf("phase angle %.2f°\n", PhaseAngle*180/math.Pi) }