Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cmal/.emacs.d
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu Zhao authored and Yu Zhao committed Nov 29, 2021
2 parents 50950a5 + 5c94bb1 commit 6dd6049
Show file tree
Hide file tree
Showing 24 changed files with 2,787 additions and 105,980 deletions.
40 changes: 40 additions & 0 deletions annotations
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
(("/Users/yuzhao/gits/reinforcement_learning/btgym/btgym/datafeed/base.py" ((6221 6224 "这些param都被set到了self上" "sep") (6012 6027 "这些参数要根据数据源调整一下的" "source-specific") (17326 17329 "这些self上的属性都是最上面的parameter设置的" "sep")) "8cd323f4196e4dba4188820443799e5d") ("/Users/yuzhao/gits/reinforcement_learning/gym/gym/spaces/multi_discrete.py" ((53 66 "这个回头可能有用" "MultiDiscrete")) "5d72c2db8567027058d080d83728e763") ("/Users/yuzhao/gits/reinforcement_learning/btgym/btgym/spaces.py" ((1050 1059 "gym spaces 的例子: A dictionary of simpler spaces.
Example usage:
self.observation_space = spaces.Dict({\"position\": spaces.Discrete(2), \"velocity\": spaces.Discrete(3)})
Example usage [nested]:
self.nested_observation_space = spaces.Dict({
'sensors': spaces.Dict({
'position': spaces.Box(low=-100, high=100, shape=(3,)),
'velocity': spaces.Box(low=-1, high=1, shape=(3,)),
'front_cam': spaces.Tuple((
spaces.Box(low=0, high=1, shape=(10, 10, 3)),
spaces.Box(low=0, high=1, shape=(10, 10, 3))
)),
'rear_cam': spaces.Box(low=0, high=1, shape=(10, 10, 3)),
}),
'ext_controller': spaces.MultiDiscrete((5, 2, 2)),
'inner_state':spaces.Dict({
'charge': spaces.Discrete(100),
'system_checks': spaces.MultiBinary(10),
'job_status': spaces.Dict({
'task': spaces.Discrete(5),
'progress': spaces.Box(low=0, high=100, shape=()),
})
})
})" "DictSpace") (1575 1580 "gym的MultiDiscrete可能会有用" "class")) "34b50f3b60aba22a325f69d6e1c6a41d") ("/Users/yuzhao/gits/reinforcement_learning/btgym/btgym/server.py" ((17756 17759 "服务器的控制逻辑在这里" "run")) "09db64c4def2b2d0e1e4e148af7b075b") ("/Users/yuzhao/gits/reinforcement_learning/btgym/btgym/algorithms/rollout.py" ((5761 5771 "这里rp意思是reward_prediction" "process_rp")) "432627185e74dfd876b006cce88eb547") ("/Users/yuzhao/.emacs.d/settings/setup-python.el" nil "639aa7989f8983b5c4c8c5b7f337b0b3") ("/Users/yuzhao/py3btgym/lib/python3.7/site-packages/backtrader/cerebro.py" ((33957 33968 "一个大脑可以有多个策略" "addstrategy")) "16422f59caf1c76e2e99c1a5d75b2a41") ("/Users/yuzhao/gits/reinforcement_learning/btgym/btgym/envs/base.py" ((38410 38427 "关闭BackTrader数据服务器" "_stop_data_server") (36044 36062 "启动数据服务器,主要在处理zmq逻辑,主要逻辑在BTgymDataFeedServer这个类中" "_start_data_server") (35649 35654 "完成本幕,不关闭服务器" "_stop") (35508 35522 "返回一张图片" "rgb_array_dict") (35474 35481 "向服务器请求 _render " "_render") (34197 34203 "gymEnv 的 render mode 是控制运行速度的, human 与 batch 是相区别的, human 运行慢, batch 批量运行" "render") (33413 33418 "之前 self.env_response 是 (Observation, Reward, Info, Done), 这里是什么了?" "print") (33006 33018 "注意这个跟self.env_response不是一个变量" "env_response") (32933 32939 "上面也打印了" "action") (32888 32902 "上面打印了" "server_actions") (31760 31785 "打印看看" "print(\"action: \", action)") (29120 29125 "打印看看" "print") (29070 29106 "env_response is (Observation, Reward, Info, Done)" "self.step(self.get_initial_action())") (29055 29067 "env_response是什么样子的呢?" "env_response") (26802 26812 "hold" "actions[0]") (25419 25431 "打印 gym space, 将其转换为人类可读的文本" "_print_space") (23705 23724 "检查服务器状态,并等待服务器返回可控制状态" "_force_control_mode") (21922 21981 "数据服务使用4999端口" " data_network_address=self.data_network_address,") (21264 21312 "kill 掉使用同一端口的进程" " # 2. Kill any process using server port:") (21008 21080 "配置 zero mq bt REQ REP 服务实例,启动服务进程; zmq.REP是服务端 zmq.REQ是客户端" "Configures backtrader REQ/REP server instance and starts server process.") (16164 16212 "baseEnv 只支持一种 asset" "# Only single asset is supported by base class:") (15864 15869 "打印看看" "print") (15744 15855 "action space" " self.server_actions = {name: self.params['strategy']['portfolio_actions'] for name in self.asset_names}") (15678 15743 "初始 portfolio_actions 在 baseStrategy 中被设置为 ('hold', 'buy', 'sell', 'close')" " self.asset_names = self.params['strategy']['asset_names']") (15409 15418 "strats[0]是一个策略实例,strats[0]的结构是什么样的呢?为什么可以[0][0],[0][2]这样用?" "strats[0]") (15302 15307 "打印看看里面是什么东西" "print") (14603 15024 "engine strategy/broker 设置,这里可以添加 dividend" " strat_idx = self.engine.addstrategy(self.strategy, **kwargs)

msg += ' ' + msg2

# Second, set Cerebro-level configuration:
self.engine.broker.setcash(self.params['engine']['start_cash'])
self.engine.broker.setcommission(self.params['engine']['broker_commission'])
self.engine.addsizer(bt.sizers.SizerFix, stake=self.params['engine']['fixed_stake'])") (13327 13362 "engine是bt大脑" " if self.engine is not None:") (12797 12998 "开启数据服务" " # Connect/Start data server (and get dataset configuration and statistic):
self.log.info('Connecting data_server...')
self._start_data_server()
self.log.info('...done.')") (11600 11628 "分布式时,master数据服务的设置" " if self.data_master:") (10589 10921 "gym rendering 相关的设置" " # Set server rendering:
if self.render_enabled:
self.renderer = BTgymRendering(self.metadata['render.modes'], log_level=self.log_level, **kwargs)

else:
self.renderer = BTgymNullRendering()
self.log.info('Rendering disabled. Call to render() will return null-plug image.')") (9893 9925 "设置log" "# Logging and verbosity control:") (8086 8134 "设置策略参数" " p2 = dict( # IS HERE FOR REFERENCE ONLY") (7453 7485 "设置交易参数,主要是backtrader用的" "# Parameters and default values:")) "3a31fd8518b6dea92fc5820924c4e057"))
17 changes: 13 additions & 4 deletions custom.el

Large diffs are not rendered by default.

38 changes: 27 additions & 11 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,20 @@ BODY will be ignored."

;; add site-lisp-dir and all of its first child dir
;; to 'load-path
(defun recursively-add-dir (from to)
(defun add-current-and-children-dir (from to)
(add-to-list to from)
(dolist (f (directory-files from))
(let ((name (concat from "/" f)))
(when (and (not (equal f "."))
(not (equal f ".."))
(file-directory-p name))
(add-to-list to name)))))
(recursively-add-dir site-lisp-dir 'load-path))
(add-current-and-children-dir site-lisp-dir 'load-path))


;; Setup packages
(require 'setup-package)
(require 'setup-org)


;; Setup environment variables from the user's shell.
Expand All @@ -86,7 +87,7 @@ BODY will be ignored."
(require 'setup-os)

(require 'setup-keymaps)
(require 'setup-iterm2)
;;(require 'setup-iterm2)

;; Settings for currently logged in user
(when mac-p
Expand Down Expand Up @@ -147,18 +148,22 @@ BODY will be ignored."
;; jedi jedi-direx
;; python:
;; lsp-mode lsp-python lsp-ui helm-lsp
cakecrumbs
rust-mode
language-detection
;; w3m helm-w3m
alert org-alert suggest
ledger-mode hledger-mode vlf racket-mode
exec-path-from-shell
pangu-spacing aggressive-indent
tree-mode geiser monokai-theme haskell-mode intero helm-ag
tree-mode geiser monokai-theme haskell-mode
;; intero
helm-ag
paredit-menu paredit-everywhere
;; jdee
log4j-mode log4e
buffer-flip doom-themes
buffer-flip
;; doom-themes
go-mode go-dlv go-errcheck go-eldoc
rjsx-mode ;; for jsx
graphql-mode js-comint nvm ;; for js repl
Expand All @@ -178,11 +183,19 @@ BODY will be ignored."
xml+ ;; need by ereader
;;datetime
;;dice
;; not used but useful
define-word
groovy-mode
;; not used but useful
;; describe-number ;; 显示数字代表的字符 ;; not working
cedit
centered-window
chemtable ;; 元素周期表
;; cheat-sh ;; cannot connect
commenter ;; 多行注释
;; describe-hash

org-roam
annotate
;; org-roam-server
)
(when mac-p '(wolfram-mode
;; octave-mode
Expand All @@ -204,7 +217,9 @@ BODY will be ignored."
clj-refactor cljr-helm clojure-mode-extra-font-locking
cider
;; cider-eval-sexp-fu
company company-lsp ac-cider helm-cider
company
;;company-lsp
ac-cider helm-cider
clj-refactor 4clojure helm-clojuredocs helm-cider-history
slack))))

Expand Down Expand Up @@ -271,8 +286,6 @@ BODY will be ignored."
(require 'setup-helm))

;; (eval-after-load 'ido '(require 'setup-ido))
;; (require 'setup-org)
;; (eval-after-load 'org '(require 'setup-org))
;; (eval-after-load 'dired '(require 'setup-dired))
;; (eval-after-load 'magit '(require 'setup-magit))
;; (eval-after-load 'grep '(require 'setup-rgrep))
Expand Down Expand Up @@ -344,10 +357,12 @@ BODY will be ignored."
(require 'setup-cider)
(require 'setup-scheme)
;; (require 'setup-lsp)
(unless (eq window-system 'w32)
(when window-system
(require 'setup-fonts)
(when (display-graphic-p)
(use-font-set-ptmono)))
(use-font-set-ptmono))) )

(require 'setup-dict))

(require 'setup-elisp)
Expand Down Expand Up @@ -660,3 +675,4 @@ the sequence, and its index within the sequence."

;;(require 'annotate)
(require 'bookmark+)
(require 'setup-eaf)
28 changes: 28 additions & 0 deletions scripts/get-org.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#! /bin/sh -x -u -e
#
# Get latest version of org-mode in ~/git/orgmode.org/org-mode
#

WHERE="${HOME}/.emacs.d/site-lisp"
mkdir -p ${WHERE}
cd ${WHERE}

# pull for first time if we don't have it

if [ ! -d ${WHERE}/org ]; then
git clone [email protected]:cmal/org-mode.git org
else
# get updates, if any
cd ${WHERE}/org
git pull
fi

# build the autoloads
cd ${WHERE}/org
make
make autoloads

# Add to .emacs, .emacs.d/init.el, whatever...
#
#(add-to-list 'load-path "~/git/orgmode.org/org-mode/lisp/")
#(add-to-list 'load-path "~/elisp/orgmodeorg/org-mode/contrib/lisp/" t)
3 changes: 3 additions & 0 deletions settings/setup-appearance.el
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
;; (load-theme 'afternoon)
;;(load-theme 'doom-material)
(load-theme 'doom-nord-light)
;; (load-theme 'doom-material)
;; (load-theme 'doom-challenger-deep)
;; (load-theme 'doom-tomorrow-day)
;; (load-theme 'doom-nord-light)
Expand Down Expand Up @@ -147,5 +148,7 @@
(add-to-list 'default-frame-alist '(height . 65))
)

(load-theme 'monokai)

(provide 'setup-appearance)
;;; setup-appearance.el ends here
2 changes: 2 additions & 0 deletions settings/setup-clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,7 @@ the (^:fold ...) expressions."
;; (add-to-list 'load-path "~/gits/dingtalk-clj/clomacs-demo/src/elisp/")
;; (require 'clomacs-demo)

;; TODO clojure-essential-ref-nov
;; (require 'clojure-essential-ref-nov)

(provide 'setup-clojure-mode)
57 changes: 53 additions & 4 deletions settings/setup-editing.el
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@
(lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([4 134217790 backspace 134217788 134217848 114 101 112 108 97 99 101 45 115 116 114 105 110 103 return 44 32 return 17 10 return 134217788 134217848 114 101 112 108 97 99 101 45 115 116 114 105 110 103 return 58 return 39 return 134217788 134217848 114 101 112 108 97 99 101 45 115 116 114 105 110 103 return 32 return 44 return] 0 "%d")) arg)))

;; input method
(use-package chinese-wubi
:config
(register-input-method "chinese-wubi" "Chinese-GB" 'quail-use-package "WB" "汉字输入∷五笔输入法∷")
(setq default-input-method "chinese-wubi"))
(comment
(use-package chinese-wubi
:config
(register-input-method "chinese-wubi" "Chinese-GB" 'quail-use-package "WB" "汉字输入∷五笔输入法∷")
(setq default-input-method "chinese-wubi")))
;; (toggle-input-method)

;; (when mac-p
Expand Down Expand Up @@ -496,4 +497,52 @@ instead."

(add-hook 'prog-mode 'annotate-mode)

(defun convert-dos-eol-to-unix ()
(interactive)
(let ((coding-str (symbol-name buffer-file-coding-system)))
(when (string-match "-\\(?:dos\\|mac\\)$" coding-str)
(set-buffer-file-coding-system 'unix))))

;; define `multi-occur-in-this-mode'
;; and `multi-occur-in-buffer-list'
(progn
(eval-when-compile
(require 'cl))

(defun get-buffers-matching-mode (mode)
"Returns a list of buffers where their major-mode is equal to MODE"
(let ((buffer-mode-matches '()))
(dolist (buf (buffer-list))
(with-current-buffer buf
(if (eq mode major-mode)
(add-to-list 'buffer-mode-matches buf))))
buffer-mode-matches))

(defun multi-occur-in-this-mode ()
"Show all lines matching REGEXP in buffers with this major mode."
(interactive)
(multi-occur
(get-buffers-matching-mode major-mode)
(car (occur-read-primary-args))))

(defun multi-occur-in-buffer-list ()
"Show all lines matching REGEXP in buffer list."
(interactive)
(multi-occur
(buffer-list)
(car (occur-read-primary-args))))
)

;; open file with line number: ie. /path/to/file:23
(defun find-file-at-point-goto-line (ret)
"Ignore RET and jump to line number given in `ffap-string-at-point'."
(when (and
(stringp ffap-string-at-point)
(string-match ":\\([0-9]+\\)\\'" ffap-string-at-point))
(goto-char (point-min))
(forward-line (string-to-number (match-string 1 ffap-string-at-point))))
ret)

(advice-add 'find-file-at-point :filter-return #'find-file-at-point-goto-line)

(provide 'setup-editing)
3 changes: 2 additions & 1 deletion settings/setup-fonts.el
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@
(interactive)
(set-default-font
(completing-read "Font: "
'("Monoid-12"
'("Fixedsys-11"
"Monoid-12"
"Monoisome-12"
"Inziu IosevkaCC CL-16"
"Iosevka Slab-16"
Expand Down
4 changes: 4 additions & 0 deletions settings/setup-helm.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,9 @@
(:map helm-find-files-map
("M-f" . helm-ff-run-grep-ag)))


;; for windows, ag pthread_join failed
(setq helm-grep-ag-command "rg --color=always --smart-case --no-heading --line-number %s %s %s")

(provide 'setup-helm)
;;; setup-helm.el ends here
21 changes: 21 additions & 0 deletions settings/setup-js.el
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,26 @@

(add-hook 'js-mode 'prettify-symbols-mode)


(require 'commenter)
;; (setq comment-style 'extra-line)
(setq comment-style 'indent)
(add-hook 'js-mode-hook
(lambda ()
(setq-local commenter-config
'((single
. ((comment-start . "//")
(comment-end . "")
(comment-start-skip . "\\(//+\\|/\\*+\\)\\s *")))
(multi
. ((comment-start . "/* ")
(comment-end . " */")
(comment-start-skip . "/\\*")
(comment-end-skip . "\\*/")
(comment-continue . " * ")
(comment-padding . " ")
(comment-multi-line . t)))))
(commenter-setup)))

(provide 'setup-js)
;;; setup-js.el ends here
Loading

0 comments on commit 6dd6049

Please sign in to comment.