Pythonfo's Blog

  • 首页

  • 归档

  • 关于

  • 标签

  • 分类

[Vue] Vue-Router History

发表于 2019-04-16

laravel

在项目的 routers 目录下 的 web.php 中加入下面代码

1
2
3
4
Route::get('/{html}', function ($html) {
\View::addExtension('html', 'php');
return view()->file(public_path().'/index.html');
})->where('html', '填入访问链接的正则匹配');

[服务器] 使用 SSH 免密登陆到服务器

发表于 2019-04-16

MacOS

  1. 生成密钥

    1
    ssh-keygen -o -t ras -C "<email>" -b 4096
  2. 将公钥加入到远程服务器的 authorized_keys 中

    1
    ssh-copy-id -i .ssh/id_rsa.pub <user>@<remote_ip>

Windows

  1. 安装 OpenSSH 客户端
    // 如果是 Windows10 的话,确认是否已经自带,自带了就不用装。

  2. 生成密钥

    1
    ssh-keygen -o -t ras -C "<email>" -b 4096
  3. 将公钥上传至远程服务器

    1
    scp ~/.ssh/id_rsa.pub <user>@<remote_ip>:pub_key
  4. 登陆到远程服务器

    1
    ssh <user>@<remote_ip>
  5. 将公钥加入到 authorized_keys 中

    1
    cat ~/id_rsa.pub >> ~/.ssh/authorized_keys

MongoDB

发表于 2019-04-16

创建用户管理员

1
2
3
4
5
6
7
8
db.createUser({
user: "admin",
pwd: "admin",
roles: [{
role: "userAdminAnyDatabase",
db: "admin",
}],
});

创建用户

1
2
3
4
5
6
7
8
9
10
11
db.createUser({
user: "yapi",
pwd: "yapi",
roles:[{
role: "dbAdmin",
db: "yapi",
}, {
role: "readWrite",
db: "yapi",
}],
});

Built-In Roles(内置角色):

1
2
3
4
5
6
7
8
9
1. 数据库用户角色:read、readWrite;
2. 数据库管理角色:dbAdmin、dbOwner、userAdmin;
3. 集群管理角色:clusterAdmin、clusterManager、clusterMonitor、hostManager;
4. 备份恢复角色:backup、restore;
5. 所有数据库角色:readAnyDatabase、readWriteAnyDatabase、userAdminAnyDatabase、dbAdminAnyDatabase
6. 超级用户角色:root
7. 内部角色:__system

// 这里还有几个角色间接或直接提供了系统超级用户的访问(dbOwner 、userAdmin、userAdminAnyDatabase)

角色解析

  • Read:允许用户读取指定数据库
  • readWrite:允许用户读写指定数据库
  • dbAdmin:允许用户在指定数据库中执行管理函数,如索引创建、删除,查看统计或访问system.profile
  • userAdmin:允许用户向system.users集合写入,可以找指定数据库里创建、删除和管理用户
  • clusterAdmin:只在admin数据库中可用,赋予用户所有分片和复制集相关函数的管理权限。
  • readAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的读权限
  • readWriteAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的读写权限
  • userAdminAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的userAdmin权限
  • dbAdminAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的dbAdmin权限。
  • root:只在admin数据库中可用。超级账号,超级权限

Git

发表于 2019-04-08 | 更新于 2019-04-16 | 分类于 版本控制

创建空分支

1
git checkout --orphan <BRANCH_NAME>

更新远程分支列表

1
2
git remote update origin --prune
git remote update origin -p

删除本地分支

1
git branch -d BRANCH_NAME

删除远程分支

1
2
git push origin -d BRANCH_NAME
git push origin --delete BRANCH_NAME

新增本地分支

1
git branch BRANCH_NAME

切换本地分支

1
git checkout BRANCH_NAME

新增并切换分支(本地)

1
git checkout -b BRANCH_NAME

Hackintosh

发表于 2019-04-08 | 更新于 2019-04-16

VSCode: Manual

发表于 2019-04-06 | 更新于 2019-04-16

Visual Studio Code on macOS

Launching from the command line

You can also run VS Code from the terminal by typing ‘code’ after adding it to the path:

  • Launch VS Code.
  • Open the Command Palette (kb(workbench.action.showCommands)) and type ‘shell command’ to find the Shell Command: Install ‘code’ command in PATH command.

macOS shell commands

  • Restart the terminal for the new $PATH value to take effect. You’ll be able to type ‘code .’ in any folder to start editing files in that folder.

Note: If you still have the old code alias in your .bash_profile (or equivalent) from an early VS Code version, remove it and replace it by executing the Shell Command: Install ‘code’ command in PATH command.

To manually add VS Code to your path, you can run the following commands:

1
2
3
4
cat << EOF >> ~/.bash_profile
# Add Visual Studio Code (code)
export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
EOF

Start a new terminal to pick up your .bash_profile changes.

Note: The leading slash \ is required to prevent $PATH from expanding during the concatenation. Remove the leading slash if you want to run the export command directly in a terminal.

Workbench

Easier Display Language configuration (March 2019 version 1.33)

Running the Configure Display Language command will now open a Quick Pick listing the available locales based on the Language Packs you have installed, instead of only opening the locale.json file. When you make a selection, the locale will be automatically updated and you’ll be prompted to restart VS Code for the change to take effect.

其他

Configuration Shell

MacOS
修改集成终端

1
2
3
{
"terminal.integrated.shell.osx": "/bin/zsh"
}

Dart: Classes

发表于 2019-04-04 | 更新于 2019-04-16 | 分类于 编程语言 - Programming language , 面向对象 - OOP
Pythonfo

Pythonfo

I don't know how to use python.
7 日志
3 分类
9 标签
GitHub
© 2019 Pythonfo
由 Hexo 强力驱动 v3.8.0
|
主题 – NexT.Gemini v7.1.0