1 | """https://leetcode.com/problems/search-insert-position/submissions/""" |
valid-palindrome
1 | """ |
windows-pymol
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pymol
pip install Pmw-2.0.1-py3-none-any.whl
pip install pymol-2.4.0a0-cp37-cp37m-win32.whl
pip install pymol_launcher-2.1-cp37-cp37m-win32.whl
C:\Users\zzp\AppData\Local\Programs\Python\Python37-32\Scripts\pymol.exe
draw-io-export
draw.io做好图后,crop 导出为pdf格式,然后用linux下命令gs, convert[负责压缩]转化为tif格式
pdb2tif
1 | #!/bin/sh |
pip
pypi 镜像使用帮助
临时使用
1 | pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package |
设为默认
升级 pip 到最新的版本 (>=10.0.0) 后进行配置:
1 | pip install pip -U |
如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:
1 | pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U |
服务器上同步/备份大量文件的处理方式
parsyncfp
hjmangalam/parsyncfp: follow-on to parsync (parallel rsync) with better startup perf
1 | ./parsyncfp --NP=4 --CS=100K --nowait --rsyncopts="-uv" --startdir="/home/zzp" "test" "/home/zzp/program/" |
rsync + parallel
将1
2
3
4
5
6
7
8
9
10
11
12
并行增量备份的另一种实现(rsync+parallel)
```bash
#!/bin/bash
dst="/mnt/500G移动硬盘/results/"
filename="backuplist"
ncpu=8
cat $filename | parallel -j $ncpu "rsync -urv {} $dst"
sys-settrace
sys.settrace 为built-in函数
底层实现代码
sys.settrace 调用关系
- https://github.com/python/cpython/blob/master/Python/sysmodule.c
- https://github.com/python/cpython/blob/master/Python/ceval.c
PyFrameObject 实现
- https://github.com/python/cpython/blob/master/Include/frameobject.h
- https://github.com/python/cpython/blob/master/Objects/frameobject.c
1 | import sys |
pysnooper.debug
输出日志文件名称
1 | @pysnooper.snoop("test.log") |
定义debug的函数调用层级
1 | @pysnooper.snoop("test.log", depth=2) |
添加非局部变量的修改记录
1 | @pysnooper.snoop("test.log", variables=('K', 'P')) |
1 | import pysnooper |
install-htop-ncurses-locally
install ncurses1
2
3tar zxf ncurses-6.1.tar.gz
./configure --prefix=/home/zzp/.local
make && make install
install htop1
2tar zxf htop.tar.gz
./configure --prefix=/home/zzp/.local CFLAGS=-I/home/zzp/.local/include LDFLAGS=-L/home/zzp/.local/lib
python-SMS-notify
1 | pip3 install twilio |
1 | from twilio.rest import Client |