数据可视化:matplotlib animation 绘制动画
1. 用 matplotlib animation 绘制动画
ref: https://matplotlib.org/3.1.1/api/animation_api.html
1 | import matplotlib.animation as animation |
XPS9370 关闭屏幕动态亮度
数据可视化:matplotlib marker 设置间隔
matplotlib marker 设置间隔
ref: https://matplotlib.org/3.1.1/gallery/lines_bars_and_markers/markevery_demo.html?highlight=markevery
matplotlib 绘制曲线时如果数据点较多, 添加 marker 后会出现 marker 重叠或太密集的现象, 可以用 markevery
来控制 marker 的间距。
1 | plt.plot(x, y, marker='o', markevery=10) |
frp配置内网穿透、ssh远程连接、systemctl自启动
1.内网穿透
1.1 服务器端 VPS 配置
下载匹配的版本,https://github.com/fatedier/frp/releases
- 修改 frps.ini 文件:
1
2
3# frps.ini
[common]
bind_port = 7000 - 启动 frps:
1
./frps -c ./frps.ini
frp配置内网穿透、通过rdp远程桌面控制windows系统
1.内网穿透
1.1 服务器端 VPS 配置
下载匹配的版本,https://github.com/fatedier/frp/releases
- 修改 frps.ini 文件:
1
2
3# frps.ini
[common]
bind_port = 7000 - 启动 frps:
1
./frps -c ./frps.ini
使用 scoop 安装管理 windows 软件
runcat-pyqt5-win:在windows任务栏养猫
runcat-pyqt5-win
RunCat是一款 mac应用,用奔跑的猫来显示当前系统资源(CPU)占用情况。
但是只有mac版,于是用python撸了一个,可以在windows任务栏(通知区域)养猫。
首先用psutil
获得CPU或内存的使用情况,然后用pyqt5创建QSystemTrayIcon显示在任务栏的托盘区域。
GPU的使用情况可以用 nvidia-ml-py, https://pypi.org/project/nvidia-ml-py/
的pynvml模块(仅限nvidia gpu)。
XPS9370(UHD620集显)使用Solidworks卡顿
2019年升级了装备 XPS 9370,但是 Solidworks 2014使用时非常卡。
XPS 9370 配置的是 Intel UHD 620 集显,公司还有个笔记本是 ThinkPad New S2,是HD 620显卡,solidworks 却不卡。
解决办法:改注册表
将 Solidworks 2016 原有的显卡系列随便选一个导出来,然后用文本编辑器打开,将显卡系列的名称(如 HD Graphics)改为 UHD Graphics 620,Workarounds 值改为 00000009。
或直接将以下导入注册表。
1 | Windows Registry Editor Version 5.00 |
以下方法已失效!
在网上搜了一圈大致有以下几个解决方法:
- 一、在 Solidworks 的选项里,勾选启动 OpenGL 软件加速;
- 找到了 OpenGL 选项,发现默认是已勾选的,状态还是灰色的,根本改不了;
RTX2070显卡、tensorflow-gpu、CUDA10安装
使用python定时自动截屏,发邮件通知
前一段做试验,需要远程监控现场的电脑;
写了一个定时截屏并把图片发送至邮箱的脚本,这样微信就可以得到通知。
1. 截屏,并保存图片
1 | from PIL import ImageGrab |
2. 定时任务
1 | import threading |
使用 python 批量将xls文件转换为xlsx
处理excel数据时遇到了个问题,数据导出来总是不全。
后来发现是 *.xls 格式的问题:
xls格式 最大行数为
65535
xlsx格式 最大行数为
1048576
(满足要求了)
而且xlsx文件大小只有原来的1/3左右。
但是手上有一大堆旧的xls文件需要转换。
解决方法:
安装pywin32
1 | pip install pywin32 |
代码
1 | import os |
jupyter 设置远程访问
在vps上安装jupyter,设置远程访问。
0. 安装jupyter
1 | pip install jupyter |
1. 生成密码
打开python:
1 | from notebook.auth import passwd |
根据提示输入密码,得到类似下面的密文:
‘sha1:ce23d945972*********’
复制下来。
2. 生成配置文件:
1 | jupyter notebook --generate-config |
3. 修改配置文件
sudo nano jupyter_notebook_config.py
1 | c.NotebookApp.ip = '*' |
4. 启动jupyter
1 | nohup jupyter notebook & |
5. 远程登录
试试打开 http://xxx.xxx.xxx.xxx:3333
输入第一步设置的密码即可
Hexo 使用 Webhook 自动部署
pandas列名的修改
pandas显示完整的行或列
pandas显示完整的行或列,避免省略中间行或列、以及自动换行。
1 | import pandas as pd |
pandas时间序列及绘图
pycharm配置pyqt5-tools
pip 安装 pyqt5-tools
1 | pip install pyqt5-tools -i https://pypi.mirrors.ustc.edu.cn/simple/ |
启动 pycharm, 打开 Settings -> Tools -> External Tools
点击+,添加工具
添加 pyqtdesigner
1
2
3
4
5- Name: pyqtdesigner
- Program: C:\......\designer.exe
- Working dir: $ProjectFileDir$添加 pyuic5
1
2
3
4
5
6
7- Name: pyuic5
- Program: C:\......\pyuic5.exe
- Arguments: $FileName$ -o $FileNameWithoutExtension$.py
- Working dir: $FileDir$
python调用ffmpeg处理视频-提取图片
ffmpeg 使用说明
查看使用说明:ffmpeg -h
。
1 | # usage: |