Bash

查看ip

  1. curl ifconfig.co/json
  1. {
  2. "ip": "103.122.119.183",
  3. "ip_decimal": 1736079287,
  4. "country": "Taiwan",
  5. "country_iso": "TW",
  6. "country_eu": false,
  7. "latitude": 23.5,
  8. "longitude": 121,
  9. "time_zone": "Asia/Taipei",
  10. "asn": "AS134098",
  11. "asn_org": "Licson Internet Service",
  12. "user_agent": {
  13. "product": "Mozilla",
  14. "version": "5.0",
  15. "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",
  16. "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"
  17. }
  18. }

Terminal代理

  1. export http_proxy="http://localhost:4780"
  2. export https_proxy="http://localhost:4780"

Conda

查看channels信息

  1. conda config --show channels

移除channel

  1. conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

创建环境

  1. conda create -n dl python=3.8

删除环境

  1. conda remove -n py36 --all

激活环境

  1. conda activate py36

退出环境

  1. conda deactivate

删除tar包

  1. conda clean --tarballs

python

画图

  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import cv2
  4. %matplotlib inline
  5. %config InlineBackend.figure_format='retina'
  6. # %config InlineBackend.figure_formats='svg'
  7. # Read in the images
  8. image_stripes = cv2.imread('images/stripes.jpg')
  9. # Change color to RGB (from BGR)
  10. image_stripes = cv2.cvtColor(image_stripes, cv2.COLOR_BGR2RGB)
  11. # Read in the images
  12. image_solid = cv2.imread('images/pink_solid.jpg')
  13. # Change color to RGB (from BGR)
  14. image_solid = cv2.cvtColor(image_solid, cv2.COLOR_BGR2RGB)
  15. # Display the images
  16. f, (ax1,ax2) = plt.subplots(1, 2, figsize=(10,5))
  17. ax1.imshow(image_stripes)
  18. ax2.imshow(image_solid)
  19. plt.savefig('tmp.pdf', bbox_inches='tight')
  20. plt.show()

Tensorflow2

TF1 转 TF2

  1. import tensorflow.compat.v1 as tf
  2. tf.disable_v2_behavior()