Skip to content

Instantly share code, notes, and snippets.

View tamago324's full-sized avatar
⌨️
Enjoy Keeb!

tamago324 tamago324

⌨️
Enjoy Keeb!
  • japan
View GitHub Profile
@tamago324
tamago324 / .zshrc
Last active October 17, 2020 15:00
git clone https://git.io/JTcQJ ~/tmp/dotfiles
### Added by Zinit's installer
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit"
command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \
print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
print -P "%F{160}▓▒░ The clone has failed.%f%b"
fi
source "$HOME/.zinit/bin/zinit.zsh"
@tamago324
tamago324 / ghq.py
Last active October 2, 2020 16:21
LeaderFのソースに独自のコマンドを追加する (popup は非対応)
"""
./leaderf/ghq.py
"""
from functools import wraps
from ghqExpl import GhqExplManager
from leaderf.utils import lfCmd
def command(func):
"""
:Leaderf ghq
してから
py3file ~\ghq\github.com\tamago324\sandbox\vim\leaderf\add_command_leaderf_ghq.py
で読み込む
"""
from functools import wraps
from ghqExpl import ghqExplManager
@tamago324
tamago324 / 2020-09-26-kigohyonituiterikaisitai.markdown
Created September 25, 2020 17:11
記号表について、ちょっと理解した気になった

title: kigohyonituiterikaisitai

date: 2020-09-26 01:15 tags: [] categories: []


                      // (1)
# vim: set fenc=utf-8 ft=dosini:
# define a new task named "file-build"
[file-build]
# shell command, use quotation for filenames containing spaces
# check ":AsyncTaskMacro" to see available macros
command=gcc -g "$(VIM_FILEPATH)" -o "$(VIM_FILEDIR)/$(VIM_FILENOEXT).exe"
# working directory, can change to $(VIM_ROOT) for project root
"""
中置記法の数式のASTを作成する
graphviz のテキストも出力できる
expr -> expr + term
| expr - term
| term
term -> term * factor
| term / factor
@tamago324
tamago324 / graphviz.py
Last active September 5, 2020 13:21
四則演算 (1桁の数値) の数式からASTを生成
""" Graphviz で使えるテキストを吐き出すやつ
"""
from node import Node, NodeKind
def gen(node: Node, node_id=""):
if node.kind == NodeKind.NUM:
# 数値は値を表示
print(f'\t{node_id} [label="{node.value}"];')
"""
中置記法の数式のASTを作成する
graphviz のテキストも出力できる
expr -> expr + term
| expr - term
| term
term -> term * factor
| term / factor
"""
expr -> expr + term
| expr - term
| term
term -> term * factor
| term / factor
| factor
factor -> digit
| ( expr )
"""
expr -> expr + term
| expr - term
| term
term -> term * factor
| term / factor
| factor
factor -> digit | ( expr )