WSL自动启动 service

问题

WSL 无法自启动service

image-20210908181459004

解决方式

1. 新建bat脚本

例如需要自启动 sshdocker 服务,新建一个 wsl_startup.bat如下

1
2
wsl -d Ubuntu -u root -e sudo service ssh start
wsl -d Ubuntu -u root -e sudo service docker start

这里的 -d 用于指定不同的WSL,可在 CMD 通过 wsl -l 查询到

image-20210908182257147

2. 复制脚本到windows自动目录

运行中输入 shell:startup

image-20210908181836285

复制刚才新建的脚本到此目录

image-20210908182008660

3. 重启系统

aws-shell "'Namespace' object has no attribute 'cli_binary_format'"

问题

https://github.com/awslabs/aws-shell/issues/238

aws-shell中运行cli命令时候失败

img

这个是因为当前aws-shell 并不支持 awscli v2

解决办法

mac

  1. 卸载v2版本的awscli,安装v1版本的awscli
1
2
brew uninstall awscli
brew install awscli@1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
==> Downloading https://ghcr.io/v2/homebrew/core/awscli/1/manifests/1.20.10
Already downloaded: /Users/Junxin/Library/Caches/Homebrew/downloads/75028ce994004c92af6e62b87f049ae457ab15d31a5c76678659fc0eb0e324a2--awscli@1-1.20.10.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/awscli/1/blobs/sha256:4fe74c77019cd3ee34cf161f69048ab8805171e9d6236ecbf79482f12593fdf2
Already downloaded: /Users/Junxin/Library/Caches/Homebrew/downloads/73be8076212d9de63292764c90652162a78fd1f15d25ef4e411c8f18c53277bb--awscli@1--1.20.10.mojave.bottle.tar.gz
==> Reinstalling awscli@1
==> Pouring [email protected]
==> Caveats
The "examples" directory has been installed to:
/usr/local/share/awscli/examples

awscli@1 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have awscli@1 first in your PATH, run:
echo 'export PATH="/usr/local/opt/awscli@1/bin:$PATH"' >> ~/.zshrc


zsh completions and functions have been installed to:
/usr/local/opt/awscli@1/share/zsh/site-functions
==> Summary
🍺 /usr/local/Cellar/awscli@1/1.20.10: 11,559 files, 79.8MB
  1. 删除老的软链接,并根据安装v1的版本号(1.20.10)创建新的软链接。
1
2
rm /usr/local/bin/aws
ln -s /usr/local/Cellar/awscli@1/1.20.10/libexec/bin/aws /usr/local/bin/aws

隐藏ubuntu用户登录

在登录界面隐藏普通用户

/var/lib/AccountsService/users/文件夹下新建一个与用户名相同的文件,在文件中加上SystemAccount=true

e.g. 例如隐藏用户名为test_user

1
2
3
4
5
6
7
cat /var/lib/AccountsService/users/test_user
[InputSource0]
xkb=us

[User]
XSession=
SystemAccount=true

删除无用docker镜像

命令

1
2
3
docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker stop
docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker rm
docker images|grep none|awk '{print $3 }'|xargs docker rmi

Hands-on Machine Learning with Scikit-Learn & TensorFlow Study Notes—Chapter 1

本文主要记录 Hands-on Machine Learning with Scikit-Learn & TensorFlow 这本书第一章的学习笔记。

什么是机器学习?

机器学习是通过编程让计算机从数据中进行学习的科学(和艺术)。

下面是一个更广义的概念:

机器学习是让计算机具有学习的能力,无需进行明确编程。——亚瑟·萨缪尔,1959

和一个工程性的概念:

计算机程序利用经验E学习任务T, 性能是P, 如果针对任务T的性能P随着经验E不断增
长,则称为机器学习。——汤姆·米切尔,1997

阅读更多