Bash
查看ip
curl ifconfig.co/json
{
"ip": "103.122.119.183",
"ip_decimal": 1736079287,
"country": "Taiwan",
"country_iso": "TW",
"country_eu": false,
"latitude": 23.5,
"longitude": 121,
"time_zone": "Asia/Taipei",
"asn": "AS134098",
"asn_org": "Licson Internet Service",
"user_agent": {
"product": "Mozilla",
"version": "5.0",
"comment": "(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.60",
"raw_value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.60"
}
}
Terminal代理
export http_proxy="http://localhost:4780"
export https_proxy="http://localhost:4780"
Conda
查看channels信息
conda config --show channels
移除channel
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
创建环境
conda create -n dl python=3.8
删除环境
conda remove -n py36 --all
激活环境
conda activate py36
退出环境
conda deactivate
删除tar包
conda clean --tarballs
python
画图
import numpy as np
import matplotlib.pyplot as plt
import cv2
%matplotlib inline
%config InlineBackend.figure_format='retina'
# %config InlineBackend.figure_formats='svg'
# Read in the images
image_stripes = cv2.imread('images/stripes.jpg')
# Change color to RGB (from BGR)
image_stripes = cv2.cvtColor(image_stripes, cv2.COLOR_BGR2RGB)
# Read in the images
image_solid = cv2.imread('images/pink_solid.jpg')
# Change color to RGB (from BGR)
image_solid = cv2.cvtColor(image_solid, cv2.COLOR_BGR2RGB)
# Display the images
f, (ax1,ax2) = plt.subplots(1, 2, figsize=(10,5))
ax1.imshow(image_stripes)
ax2.imshow(image_solid)
plt.savefig('tmp.pdf', bbox_inches='tight')
plt.show()
Tensorflow2
TF1 转 TF2
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()