用nginx部署flask

安装uWSGI https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html apt-get install build-essential python3-dev pip3 install uwsgi 使用uWSGI 运行 运行uwsgi,假设有run.py并且使用python3 run.py可以运行项目 uwsgi --socket 0.0.0.0:5000 --protocol=http -w run:app 配置文件 创建uwsgi.ini [uwsgi] module = run:app master = true processes = 5 http = 0.0.0.0:5000 使用配置文件运行 uwsgi --ini uwsgi.ini 如果要使用nginx,应该使用socket [uwsgi] module = run:app master = true processes = 5 socket = /tmp/flask.sock chmod-socket = 666 chdir = {path} logto = {path} 添加一个服务 使用systemd 创建一个文件uwsgiproject.service……

阅读全文

禁止cloudflare以外的ip访问nginx的网站

添加一个文件cf.conf,里面记录的是允许访问的ip # https://www.cloudflare.com/ips # IPv4 allow 173.245.48.0/20; allow 103.21.244.0/22; allow 103.22.200.0/22; allow 103.31.4.0/22; allow 141.101.64.0/18; allow 108.162.192.0/18; allow 190.93.240.0/20; allow 188.114.96.0/20; allow 197.234.240.0/22; allow 198.41.128.0/17; allow 162.158.0.0/15; allow 104.16.0.0/12; allow 172.64.0.0/13; allow 131.0.72.0/22; # IPv6 allow 2400:cb00::/32; allow 2606:4700::/32; allow 2803:f800::/32; allow 2405:b500::/32; allow 2405:8100::/32; allow 2a06:98c0::/29; allow 2c0f:f248::/32; 修改 /etc/nginx/sites-available/default中的内容,添加include cf.conf和deny all location / { include /etc/nginx/cf.conf; deny all; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404.……

阅读全文

angular-matSort

angular中使用matSort对表格进行排序 https://material.angular.io/components/sort/overview ```html start time {{appointment.start_at|date:‘yyyy-MM-dd HH:mm’}} “’ matColumnDef=“start_at”和appointment.start_at|date:‘yyyy-MM-dd HH:mm’中的start_at这个变量名称要相同,不然会出现已经使用了mat-sort-header出现了箭头,点击确没有反应的情况……

阅读全文

sony-dpt获得root权限

https://github.com/HappyZ/dpt-tools/wiki/The-Ultimate-Rooting-Guide 测试连接是否成功 python3 dpt-tools.py =========== DPT Tools =========== Thanks for using DPT Tools. Type `help` to show this message. Supported commands: fw -- update firmware diagnosis -- enter diagnosis mode (to gain adb, su, etc.) exit/quit -- leave the tool [info] Please make sure you have charged your battery before this action. >>> Please enter the pkg file path: /Users/huweilun/FILES/test/sonydpt获取root权限/dpt-tools/fw_updater_packer_by_shankerzhiwu/pkg_example/hack_basics/fw.pkg >>> Pleae confirm /Users/huweilun/FILES/test/sonydpt获取root权限/dpt-tools/fw_updater_packer_by_shankerzhiwu/pkg_example/hack_basics/fw.pkg is the pkg file to use [yes/no]: yes >>> 获取adb权限……

阅读全文

powerline配置

安装 pip install powerline-status pip show powerline-status//查看安装位置 mac 修改~/.bash_profile 最后添加一行 . /.../powerline/bindings/bash/powerline.sh 若字体有问题,则安装字体 https://github.com/powerline/fonts 配置 vim ~/.config/powerline/config.json 主题 修改后能看到git状态 { "ext": { "shell": { "theme": "default_leftonly" } } } 修改config_files 在想要使用的主题文件中可以增加一些内容 vim /.../powerline/config_files/themes/shell/__main__.json shell相关的配置可以参考 https://powerline.readthedocs.io/en/latest/configuration/segments/shell.html { "segment_data": { "hostname": { "args": { "only_if_ssh": true } }, "cwd": { "args": { "dir_limit_depth": 2, "dir_shorten_len": 10 } } } } dir_shorten_len (int) – shorten parent directory names to this length (e.……

阅读全文

css相关

css显示1/3的宽度 使用css calc() .tab { width: calc(100%/3); } refer: https://stackoverflow.com/questions/18781713/css-divide-width-100-to-3-column……

阅读全文

rclone挂载网盘到vps

https://rclone.org/onedrive/ 1. 在有图形界面的机器上面授权 下载rclone https://rclone.org/downloads/ //授权 rclone authorize "onedrive" 2. 在vps上面安装rclone curl https://rclone.org/install.sh | sudo bash 2.1 设置 rclone config //查看目录 rclone lsd drivename: 3. 挂载到vps的目录上 rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --daemon rclone mount od:vps /root/onedrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --daemon df -h 查看挂载的网盘 config [email protected]:~/rclone# rclone config 2019/07/31 15:52:12 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults No remotes found - make a new one n) New remote s) Set configuration password q) Quit config n/s/q> n name> od(自己随意起的名字) Type of storage to configure.……

阅读全文

exiftool删除图片exif信息

exiftool下载地址 https://www.sno.phy.queensu.ca/~phil/exiftool/ 使用帮助 https://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html 查看信息 exiftool filname.jpg exiftool -a -u -g1 a.jpg //查看所有信息 exiftool -d '%r %a, %B %e, %Y' -DateTimeOriginal -S -s -ext jpg filename.JPG //查看时间 删除gps信息 exiftool -gps:all= filename.jpg 删除所有信息 exiftool -overwrite_original -all= filename.jpg ……

阅读全文