-
Notifications
You must be signed in to change notification settings - Fork 59
/
python.txt
344 lines (292 loc) · 9.64 KB
/
python.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
python
yum install -y python36 python36-pip
brew install python3
ln -s /usr/local/Cellar/python/3.7.0/bin/python3 /usr/local/bin/python3
安装包路径:/usr/local/lib/python3.7/site-packages/
pip3 install matplotlib -i https://pypi.douban.com/simple
https://pypi.tuna.tsinghua.edu.cn/simple
https://mirrors.aliyun.com/pypi/simple/
pip 使用阿里云的源
```
mkdir ~/.pip
cat > ~/.pip/pip.conf << EOF
[global]
trusted-host=mirrors.aliyun.com
index-url=https://mirrors.aliyun.com/pypi/simple/
EOF
Windows系统:
首先在window的文件夹窗口输入 : %APPDATA%
然后创建pip文件夹
最后创建pip.ini文件,写入如下内容
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
```
FASTAPI
https://github.com/tiangolo/fastapi
https://github.com/django/django
https://github.com/pallets/flask
pip3 list
pip3 list --outdated
pip uninstall 包名
pip install --upgrade pip
pip3 install --upgrade pip
mac: brew install pipenv
dnf install pipenv
yum install pipenv
pipenv graph
pipenv lock
pipenv install --dev
pipenv uninstall --all
pipenv shell
pipenv install requests
yum install -y m2crypto python-setuptools
easy_install pip
pip install yagmail
pip3 install yagmail
EXCEL
https://github.com/ricklamers/gridstudio
brew install rabbitmq
brew services start rabbitmq
brew install redis
brew services start redis
nameko 微服务
pip3 install nameko
vi nameko.py
from nameko.rpc import rpc
class GreetingService:
name = "nameko"
@rpc
def hello(self, name):
return "Hello, {}!".format(name)
nameko run nameko
nameko shell
> n.rpc.nameko.hello(name="test")
nameko shell --broker amqp://guest:guest@localhost
celery 并行分布式框架
pip3 install celery
pip3 install redis
vi tasks.py
from celery import Celery
import time
#app = Celery('tasks', backend='amqp', broker='amqp://')
app = Celery('tasks', broker='redis://127.0.0.1:6379/0', backend='redis://127.0.0.1:6379/0')
#redis://:password@hostname:port/db_number
@app.task
def add(x, y):
time.sleep(5)
return x + y
celery -A tasks worker --loglevel=info
celery shell
> from tasks import add
> res = add.delay(4,4)
> res.ready()
> res.ready()
> res.result
定时器
import schedule
import time
def job():
print("I'm working...")
schedule.every(10).minutes.do(job)
schedule.every().hour.do(job)
schedule.every().day.at("10:30").do(job)
schedule.every().monday.do(job)
schedule.every().wednesday.at("13:15").do(job)
schedule.every().minute.at(":17").do(job)
while True:
schedule.run_pending()
time.sleep(1)
实现一个进度条
from time import sleep
def progress(percent=0, width=30):
left = width * percent // 100
right = width - left
print('
[', '#' * left, ' ' * right, ']',
f' {percent:.0f}%',
sep='', end='', flush=True)
for i in range(101):
progress(i)
sleep(0.1)
并行处理
https://github.com/luispedro/jug
debugging
https://github.com/cool-RR/pysnooper
在线pyc,pyo反编译python反编译
http://tools.bugscaner.com/decompyle/
使用pyinstaller加密打包exe
其实只要在打包时加个key参数就能加密
pyinstaller.exe -F --key 123456 xxx.py
反编译测试
那么我们再来测试一下加密打包的exe还能不能被反编译。再次执行pyinstxtractor.py
python pyinstxtractor.py .\main-encrypt.exe
pip3 install webssh
# 直接运行wssh,使用默认8888端口
wssh
# 通过绑定IP地址和端口启动
wssh --address='192.168.83.129' --port=8888
wssh --address='0.0.0.0' --port=8888
# 通过绑定IP地址和端口启动,只允许本地地址访问
wssh --address='127.0.0.1' --port=8888
https://github.com/tqdm/tqdm
https://github.com/dbcli/pgcli
https://github.com/dbcli/mycli
pip install rich
q - Run SQL directly on CSV or TSV files
http://github.com/harelba/q
q "SELECT COUNT(*) FROM ./clicks_file.csv WHERE c3 > 32.3"
ps -ef | q -H "SELECT UID, COUNT(*) cnt FROM - GROUP BY UID ORDER BY cnt DESC LIMIT 3"
https://harelba.github.io/q/
wget https://github.com/harelba/q/releases/download/1.7.1/q-text-as-data-1.7.1-1.noarch.rpm #下载版本
sudo rpm -ivh q-text-as-data-1.7.1-1.noarch.rpm # 安装
q --version #查看安装版本
https://mp.weixin.qq.com/s/4QpCXwvbaExj73k3vTguZg
压力测试
pip install locust
locust -V
Python 字节码反编译器
https://github.com/rocky/python-uncompyle6
https://github.com/rocky/python-decompile3
uncompyle6 abc_text.pyc > abc_text.py
decompyle3 *compiled-python-file-pyc-or-pyo*
https://www.numpy.org.cn/
https://www.scipy.org/
https://pandas.pydata.org/
https://www.statsmodels.org/
https://scikit-learn.org.cn/
https://xgboost.ai/
https://lightgbm.readthedocs.io
https://catboost.ai/
https://eli5.readthedocs.io
https://pypi.org/project/Theano/
https://github.com/pybrain/pybrain/
https://github.com/shogun-toolbox/shogun
https://www.cnpython.com/pypi/chainerrl
http://github.com/lisa-lab/pylearn2
https://www.oschina.net/p/hebel/
https://pythonhosted.org/neurolab/
https://www.tensorflow.org/
https://pytorch.org/
https://keras.io/zh/
http://caffe.berkeleyvision.org/
https://joerihermans.com/work/distributed-keras/
https://pypi.org/project/elephas/
https://databricks.github.io/spark-deep-learning/
https://pypi.org/project/mxnet/
https://github.com/sklearn-theano/
https://www.nltk.org/
https://spacy.io/
https://pypi.org/project/pkuseg/
https://radimrehurek.com/gensim/
https://stanfordnlp.github.io/CoreNLP/
https://pypi.org/project/textblob/
https://github.com/stanfordnlp/stanfordnlp
https://opencv.org/
https://scikit-image.org/
https://pillow.readthedocs.io/en/stable
http://simplecv.org/
https://pypi.org/project/mahotas/0.99/
https://itk.org/
https://pythonhosted.org/pgmagick/index.html
https://www.cairographics.org/pycairo/
https://pypi.org/project/fastai/
https://pypi.org/project/imutils/
https://pytorch-cn.readthedocs.io/zh/latest/
https://biopython-cn.readthedocs.io/
http://dash.plot.ly/dash-bio
http://www.rdkit.org/
https://matplotlib.org/
https://github.com/matplotlib/matplotlib
http://www.gnuplot.info/
https://www.gnu.org/software/octave/index
Grace
https://labplot.kde.org/
https://root.cern/
https://matplotlib.org/stable/tutorials/introductory/sample_plots.html
https://github.com/nicolargo/glances
https://github.com/pypa/pipx
brew install pipx
pipx install pycowsay
pipx list
pycowsay mooo
Python的打包神器——Nuitka
https://mp.weixin.qq.com/s/H34qnVEgMYFm0pRee94okQ
pip3 install Nuitka
nuitka --standalone --show-memory --show-progress --nofollow-imports --plugin-enable=qt-plugins --follow-import-to=utils,src --output-dir=out --windows-icon-from-ico=./logo.ico demo.py
这里简单介绍下我上面的nuitka的命令:
--standalone:方便移植到其他机器,不用再安装python
--show-memory --show-progress:展示整个安装的进度过程
--nofollow-imports:不编译代码中所有的import,比如keras,numpy之类的。
--plugin-enable=qt-plugins:我这里用到pyqt5来做界面的,这里nuitka有其对应的插件。
--follow-import-to=utils,src:需要编译成C++代码的指定的2个包含源码的文件夹,这里用,来进行分隔。
--output-dir=out:指定输出的结果路径为out。
--windows-icon-from-ico=./logo.ico:指定生成的exe的图标为logo.ico这个图标,这里推荐一个将图片转成ico格式文件的网站(比特虫)。
--windows-disable-console:运行exe取消弹框。这里没有放上去是因为我们还需要调试,可能哪里还有问题之类的。
https://pypi.org/project/awkward/
https://github.com/mwouts/jupytext
https://github.com/gradio-app/gradio
https://github.com/activeloopai/Hub
https://github.com/facebookresearch/AugLy
https://github.com/evidentlyai/evidently
https://github.com/Megvii-BaseDetection/YOLOX
https://github.com/bytedance/lightseq
https://github.com/linkedin/greykite
https://github.com/jina-ai/finetuner
从 PDF 中提取表格数据
https://github.com/camelot-dev/camelot
空间数据可视化神器 keplergl
https://kepler.gl/
https://kepler.gl/demo
jupyter notebook使用手册地址:https://github.com/keplergl/kepler.gl/tree/master/docs/keplergl-jupyter#geojson
案例地址:https://github.com/keplergl/kepler.gl/tree/master/bindings/kepler.gl-jupyter/notebooks
pip install keplergl
视频下载工具
https://github.com/yt-dlp/yt-dlp
python3 -m pip install -U yt-dlp
brew install yt-dlp/taps/yt-dlp
yt-dlp [OPTIONS] [--] URL [URL...]
语意解析 可解析详细地址/金额/时间/关键短语/
https://github.com/dongrixinyu/JioNLP
pip install jionlp -i https://pypi.douban.com/simple/
https://github.com/django/django.git
https://flask.palletsprojects.com/en/2.0.x/
https://trypyramid.com/
https://webpy.org/
https://www.tornadoweb.org/en/stable/
https://www.turbogears.org/
https://cherrypy.org/
http://falconframework.org/
https://asgineer.readthedocs.io/
https://bottlepy.org/docs/dev/
https://emmett.sh/
https://github.com/dutradda/apidaora
http://www.quixote.ca/
https://www.reahl.org/
https://hug.rest/
https://github.com/Neoteroi/BlackSheep
https://index-py.aber.sh/stable/
https://github.com/sanic-org/sanic
https://pypi.org/project/starlette/
https://fastapi.tiangolo.com/
https://python-responder.org/
https://moltenframework.com/
https://github.com/mahmoud/clastic
https://docs.aiohttp.org/en/stable/
https://docs.masoniteproject.com/
https://pgjones.gitlab.io/quart/
https://github.com/Ayehavgunne/Tonberry
https://cyclone.io/
https://github.com/twisted/klein
https://github.com/nameko/nameko
https://www.cubicweb.org/
https://zope.readthedocs.io/en/latest/
http://web2py.com/
https://docs.pylonsproject.org/projects/pylons-webframework/en/latest/
https://pythonhosted.org/cubes/
https://github.com/Liangchengdeye/Dpark
https://buildbot.python.org/all/#/
https://github.com/Dragonfly/dragonfly
https://github.com/yzddmr6/WebCrack
https://github.com/CharlesPikachu/DecryptLogin