首页 » 随记

  1. 宝塔---网站(xxx.com)---设置---反向代理---找到代理目录---配置文件
    ## 加入js
    sub_filter </body> '<script src="http://h5ai1.xxx.com/api/api.js"></script></body>';
    ## 加入css
    sub_filter </head> '<link rel="stylesheet" href="http://h5ai.xxx.com/api/api.css"></head>';

1.安装cifs-utils

su root
apt update
apt install cifs-utils
  1. 创建文件夹并挂载,注意替换<password>为你的密码
mkdir -p /www/wwwroot/win

mount -t cifs -o user=shenfeng,pass=<password>,dir_mode=0777,file_mode=0777 //DESKTOP-FFPK9P7/all /www/wwwroot/win

python 多张图片合并到一张

## 多张图片合并到一张(垂直)
import sys
from PIL import Image

images = [Image.open(x) for x in ['./imgs/1_page1.jpg', './imgs/1_page2.jpg', './imgs/1_page3.jpg', './imgs/1_page4.jpg', './imgs/1_page5.jpg', './imgs/1_page6.jpg', './imgs/1_page7.jpg', './imgs/1_page8.jpg', './imgs/1_page9.jpg']]
widths, heights = zip(*(i.size for i in images))

max_width = max(widths)
total_height = sum(heights)

new_im = Image.new('RGB', (max_width, total_height))

y_offset = 0
for im in images:
  new_im.paste(im, (0,y_offset))
  y_offset += im.size[1]

new_im.save('test.jpg')

有时候安装了几个版本的python,怎么指定版本安装包呢,直接找到路径,运行下面的命令。

如我得3.7安装在 C:PythonPython37python.exe

##### 更新pip
C:\Python\Python37\python.exe -m pip install pip --upgrade pip
## 安装pymysql 
 C:\Python\Python37\python.exe -m pip install pymysql    

##### 安装cryptography ---pymysql连接密码会用到

 C:\Python\Python37\python.exe -m pip install cryptography 

使用国内景象安装,中间会让你选择镜像源

安装brew
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
安装python
brew install pyton 
修改.bash_profile
vi ~/.bash_profile 

PATH="/usr/local/bin/python3/bin:${PATH}"

export PATH
修改.bashrc
sudo vi ~/.bashrc

alias python2='/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'

alias python3='/usr/local/bin/python3'

alias python=python3
使生效
source ~/.bash_profile

source ~/.bashrc
安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py