盛艳明的博客


  • 首页

  • 归档

  • 标签

  • 搜索

mac 下给pip换源

发表于 2017-08-09 |
  1. 在终端进入目录:cd ~/
  2. 如果没有 .pip 文件夹,那么就新建这个文件夹,mkdir .pip
  3. 然后在 .pip 文件夹内新建一个文件 touch pip.conf
  4. 编辑pip.conf 文件,写入第三方源
1
2
3
4
5
6
7
8
阿里云:
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
1
2
3
4
5
6
7
8
豆瓣:
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
1
2
3
4
清华:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

pass密码保存工具

发表于 2017-08-05 |

安装

1
mac 系统:brew install pass

生成GPG密匙对

1
2
gpg --gen-key
注意:运行以上的命令以生成 GPG 密钥对时会有一系列的问题询问,谨慎输入问题的答案,其中有一些只要使用默认值即可

初始化密码存储

1
pass init s_abcabc@126.com

查看密码目录树

1
2
3
4
5
pass
或
pass ls
或
pass show

插入一个新密码

1
2
3
pass insert <密码路径>
例子:保存邮箱密码
pass insert eMail/s_abcabc@126.com

显示已有密码

1
2
3
4
5
pass show <密码路径>
例子:
pass show eMail/s_abcabc@126.com
会弹出一个对话框让你输入pass的密码
输入完成后将会在终端显示s_abcabc@126.com邮箱的密码

生成密码

1
2
3
4
Generate new password
zx2c4@laptop ~ $ pass generate Email/jasondonenfeld.com 15
The generated password to Email/jasondonenfeld.com is:
$(-QF&Q=IN2nFBx

copy密码

1
2
3
4
Copy existing password to clipboard
zx2c4@laptop ~ $ pass -c Email/zx2c4.com
Copied Email/jason@zx2c4.com to clipboard. Will clear in 45 sec-
onds.

pythonStudy

发表于 2017-08-04 |

Python 中from… import 与 import…. as的区别

from… import

​ 如 from A import b,相当于

​ import A

​ b = A.b

​ 再如:

​ “from t2 import var1” 相当于:

​ import t2

​ var1 = t2.var1

​ 在此过程中有一个隐含的赋值的过程

​ import… as

​ import A as B,给予A库一个B的别称,帮助记忆。

pyCharm 当中使用VirtualEnv


python 类

1
type() :判断对象的类型

fastJson将javabean转为Map

发表于 2017-07-10 |

问题:我们有时候希望写的javabean转换为Map方便数据操作,那么我们怎么做呢?

​

1
2
3
4
5
6
7
8
9
10
11
答: Person person = new Person();
person.setUserName("盛艳明");
person.setAge(27);
//将javabean转为map
Map map = JSON.toJSON(person);
System.out.println(map.toString());

常用网址

发表于 2017-07-08 |

vim 常用网址

VimAwesome

很方便查找各种vim常用插件

html5_study

发表于 2017-07-06 |

HTML 5 全局 contenteditable 属性

说明图片

为了写一个富文本编辑器上个周末和这个周一真的很累,本来想着用一个开源大神写的richEdit来实现发现还是有很多局限性的,richedit 就是使用了html 5的一个global 属性contenteditable属性让div具有了可编辑内容的效果,但是如果我想在div中添加一个图片,图片点击后右上角会出现一个删除按钮这样稍微复杂一些的操作就不行了,因为这个属性是让div里面包含的所有的子元素都可以编辑。

我认为的知识点

  1. html dom tagName 属性

​ 定义和用法
tagName 属性返回元素的标签名。
在 HTML 中,tagName 属性的返回值始终是大写的。

gitsubnodule的使用

发表于 2017-07-02 |

git 仓库中添加子仓库

  • git submodule add <子module的远程仓库地址>

git 删除子仓库

  • Delete the relevant section from the .gitmodules file.

  • Stage the .gitmodules changes git add .gitmodules.

  • Delete the relevant section from .git/config .

  • Run git rm –cached path_to_submodule (no trailing slash).

  • Run rm -rf .git/modules/path_to_submodule.


    问题记录:

    问题一: 重新add子module的时候提示: ‘repo’ already exists in the index

    解决办法:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    $ rm -Rf rack/
    $ git submodule add git@github.com:schacon/rack.git rack'rack' already exists in the index
    You have to unstage the rack directory first. Then you can add the submodule:
    $ git rm -r rack
    $ git submodule add git@github.com:schacon/rack.git rack

​ 在.gitmodules配置文件中删除子module的相关配置后要记得使用

git rm –cached path_to_submodule (no trailing slash).删除缓存否则别人删除的子module会一直报url找不到的错误

learn_git

发表于 2017-07-01 |

git path的用法

git 配置冲突合并工具KDiff3

1
2
3
git config --global --add diff.guitool kdiff3
git config --global --add difftool.kdiff3.path "/Applications/kdiff3.app/Contents/MacOS/kdiff3"
git config --global --add difftool.kdiff3.trustExitCode false

KDiff3下载地址

Hexo常用命令总结

发表于 2017-07-01 |

新写一篇blog:

hexo new post "article-tile"
这个时候就可以在hexo根目录下的source\_posts下看到新生成的文件article-title.md

生成

hexo g

部署

hexo d

上面的两个命令可以组合成一个

​ 还可以使用组合命令:hexo g -d


以上内容是生成和发布博客的一般流程,下面我记录一下我的github + hexo搭建流程供有需要的人参考和学习

  • 申请github

    • 这个就不多说了
    • 建立github.io 这个自己可以百度一下教程
  • 搭建hexo

    • !官网 :有详细的使用说明,本教程就是说明一下其中常用的
    • 安装Node.js
      • $ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
      • nvm install stable
    • 安装hexo
      • npm install -g hexo-cli
      • hexo init
      • cd
      • npm install
  • 安装主题

    • Yilia

    • NexT

    • 1
      这些都有相关的教程可以去github上搜索,然后看教程配置使用

      ​

123
盛艳明

盛艳明

29 日志
18 标签
RSS
GitHub ZhiHu
© 2017.06 - 2018 盛艳明
由 Hexo 强力驱动
主题 - NexT.Muse
访问人数 人次 总访问量 次