突突唧之家

我的疑问 & 我的解决方案

Display members of a group using /etc/group file

Use the grep command as follows (we are looking group named "ftponly"):

grep ftponly /etc/group

To get just a list of all members of a group called "ftponly", type the following awk command:

awk -F':' '/ftponly/{print $4}' /etc/group

Display group memberships for each Linux user

Want to see group memberships for each given USERNAME under Linux? The syntax is as follows for the groups command:

groups your-user-name-here

使用命令

ssh -o ProxyCommand='"C:\Program Files\Git\mingw64\bin\connect.exe" -S 127.0.0.1:1080 %h %p' remoteuser@remotehost

这里 Git 的安装路径和后面的代理自己看着填,不要用相对路径。 参数中 -S 指是 socks 代理,默认是 socks5。如果要使用 HTTP 代理,就写 -H

With Docker 1.8.1 (August 2015), a docker inspect -f '{{ .Volumes }}' containerid would be empty!

You now need to check Mounts, which is a list of mounted paths like:

1
2
3
4
5
6
7
8
9
10
11
12
{
"Mounts": [
{
"Name": "7ced22ebb63b78823f71cf33f9a7e1915abe4595fcd4f067084f7c4e8cc1afa2",
"Source": "...",
"Destination": "...",
"Driver": "local",
"Mode": "",
"RW": true
}
]
}

If you want the path of the first mount (for instance), that would be (using index 0):

docker inspect -f '{{ (index .Mounts 0).Source }}' containerid

Pretty print the whole thing:

docker inspect -f '{{ json .Mounts }}' containerid | python -m json.tool

Or use the jq command:

docker inspect -f '{{ json .Mounts }}' containerid | jq

After installing the NVIDIA container runtime, you should install all necessary packages:

apt update
apt install ocl-icd-libopencl1 opencl-headers clinfo

Enable OpenCL by:

mkdir -p /etc/OpenCL/vendors
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd

A system option was added in snap 2.28 to specify the proxy server.

sudo snap set system proxy.http="http://<proxy_addr>:<proxy_port>"
sudo snap set system proxy.https="http://<proxy_addr>:<proxy_port>"

Use os.popen():

output = os.popen('ls').read()

The newer way (> Python 2.6) to do this is to use subprocess:

output = subprocess.Popen('ls', stdout=subprocess.PIPE).stdout.read()

Multiplying the loss with 0.0 will create zero gradients. However, your model could still "change". For example, since running stats are updated in each forward pass in batchnorm layers during training (i.e. if the model is in model.train() mode). Also, the optimizer could still update parameters if its using running stats (e.g. Adam) and if the parameters were already updated (i.e. if the running stats are already set) even if the gradient is set to zero.

Here is the simplest solution:

ssh-keygen -R <host>

For example,

ssh-keygen -R 192.168.3.10

From the ssh-keygen man page:

-R hostname Removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts (see the -H option above).

Docker stores downloaded images, running containers, and persistent volume data in a single shared directory root on your system drive. You can customize your configuration to use an external drive, network share, or second internal disc if you need to add storage to your installation.

Preparation

The main part of this guide applies to Docker Engine for Linux and Docker Desktop on Windows and Mac. You'll need to find your Docker daemon.json file on all three platforms. This will be in one of the following locations:

  • /etc/docker/daemon.json on Linux.
  • %programdata%\docker\config\daemon.json on Windows.
  • ~/Library/Containers/com.docker.docker/Data/database/com.docker.driver.amd64-linux/etc/docker/daemon.json on Mac.

Docker advises that Windows and Mac users update the config file via the UI, instead of manually applying changes in a text editor. You can access the settings screen by heading to Preferences > Docker Engine > Edit file in the Docker Desktop interface.

阅读全文 »

If it's the first time you check-out a repo you need to use --init first:

git submodule update --init --recursive

For git 1.8.2 or above, the option --remote was added to support updating to latest tips of remote branches:

git submodule update --recursive --remote

This has the added benefit of respecting any "non default" branches specified in the .gitmodules or .git/config files (if you happen to have any, default is origin/master, in which case some of the other answers here would work as well).