#go #hugo

hugo hexo 傻傻分不清出 GO实现

hugo 像 hexo 一样的 静态网站生成 重点,就是 FF_FFFFF_FFFFFFFF____FFFFast 不过,网上找到的都很多是基本例子 不过也没有要做的高级例子。 三部走 下载 $ brew install hugo $ hugo version 创建 $ hugo new site quickstart 加皮肤 themes cd quickstart;\ git init;\ git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke;\ # Edit your config.toml configuration file # and add the Ananke theme. echo 'theme = "ananke"' >> config.toml 噢不止三步, 那四部 - 加文章 hugo new posts/my-first-post. ...

#npm #zsh

zsh completion tab 补全提示

npm 和 git 补全噢😯 npm <Tab> 会补全命令 npm实现代码 https://github.com/npm/npm/blob/master/lib/utils/completion.sh or npm completion git 实现代码 分终端(zsh,bash..) 分实现文件 https://github.com/git/git/blob/master/contrib/completion/ 因为npm 的实现文件只有一个,懒为主。 我的是 zsh 首先定义一个可执行文件 sh test_completion.sh if type compdef &>/dev/null; then _test_completion() { } compdef _test_completion npm 当你运行上面 什么都没有的 文件时 or 复制 then 后面那段代码,粘贴到 命令行运行也可以。 之前npm <Tab> 的 提示就会没有 ## 代码分解 if type 是为了判断 compdef 是否存在 这是 zsh 定义的 函数命令 &>/del/null 应该是把 错误 文件化 放到 /dev/null compdef _test_completion npm 这里有三个变量 compdef 是 函数调用 _test_completion 是 compdef 的第一个变量,用来定义 补全规则 compdef(_test_completion) npm 是 compdef 的第二个变量。补全对象 compdef( _test_completion, npm ) 只要把 npm 替换成 git 那么, git 的 补全命令 也会被替换 什么都没有。 补全规则 _test_completion(){ } zsh 实现了 简便的 命令添加-函数 compadd 源代码中主要 compadd -- $(COMP_CWORD=$((CURRENT-1)) \ COMP_LINE=$BUFFER \ COMP_POINT=0 \ npm completion -- "${words[@]}" \ 2>/dev/null) 这样的 ,不难看出 – $ 后面就是 compadd函数 - 变量定义 源文档太大了,截掉什么看看区别 当我把 npm completion -- "${words[@]}" \ 剪掉 npm <Tab>什么提示都没有了,看来这就是秘密。 不过我们看了终点,不如回到原点。加加看 示例 _test_completion() { compadd -- install } compdef _test_completion npm $ npm <tab> $ npm install 噢 那么就会提示 install 再试试 _test_completion() { echo "${words[@]}" echo $CURRENT echo $BUFFER compadd -- install up } compdef _test_completion npm ...

#python #pipenv

pipenv 快速构建虚拟python环境

pipenv python的快速构建虚拟环境 使用 pip install pipenv 搭建 pipenv --three pipenv --two –three 3.x版本 –two 2.x版本 主要下载问题 1. pipenv 无法与 conda 或 其他 虚拟环境搭建python环境共用 必须保证,下载 pipenv的pip,是纯净的python 2. 运行 pipenv –three ,如果出现错误,像我 因为,我带有conda,所以 pipenv 会用这个的虚拟库 virtualenv 构建, 但是之前说了,为了纯净,这就会发生错误。 $ pipenv --three error $ which python anaconda/bin/python ✅ 这个时候需要手动添加那个当时 pip install pipenv 的那个python Mac oX 系统 $ pipenv --three --python /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 更多 Github 官网