Skip to content

Commit 9a141a0

Browse files
committed
feat: ipython
1 parent 3222a61 commit 9a141a0

File tree

5 files changed

+51
-11
lines changed

5 files changed

+51
-11
lines changed

README.md

+1-11
Original file line numberDiff line numberDiff line change
@@ -665,17 +665,7 @@ $ faker password
665665

666666
## [GitPython](./other_useful_library/README.md#git)
667667

668-
## [hexbytes](https://hexbytes.readthedocs.io/en/stable/)
669-
处理字符串和十六进制
670-
```python
671-
from hexbytes import HexBytes
672-
HexBytes(b"123") // HexBytes("0x313233")
673-
HexBytes(b"123").hex() // "0x0123"
674-
675-
HexBytes("123") // HexBytes("0x0123")
676-
HexBytes("123").hex() // "0x313233"
677-
678-
```
668+
## [hexbytes](./other_useful_library/README.md#hexbytes)
679669

680670
## [Humanfriendly](./other_useful_library/README.md)
681671
转化尺寸

other_useful_library/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## bitstring
2+
转化二进制数据
3+
```
4+
BitArray(HexBytes("0x7f")).int // 127 01111111
5+
BitArray(HexBytes("0x80")).int // -128 10000000
6+
```
7+
18
## [diff-match-patch](https://github.com/google/diff-match-patch)
29
用来比较文字的不同
310
* 用法
@@ -102,6 +109,20 @@ Humanfriendly.parse_size("10M") // 10_000_000
102109
Humanfriendly.parse_size("10M", binary=True) // 1024 x 1024 x 10
103110
```
104111

112+
## [hexbytes](https://hexbytes.readthedocs.io/en/stable/)
113+
处理字符串和十六进制
114+
```python
115+
from hexbytes import HexBytes
116+
HexBytes(b"123") // HexBytes("0x313233")
117+
HexBytes(b"123").hex() // "0x0123"
118+
119+
HexBytes("123") // HexBytes("0x0123")
120+
HexBytes("123").hex() // "0x313233"
121+
```
122+
* len 2个hex为1个长度
123+
* slice `HexBytes("0xffff")[0:1] == HexBytes("0xff")`
124+
* getitem `HexBytes("0xffff")[0] == 255`
125+
105126
## [imapclient](imapclient.md)
106127
很好用的邮件客户端
107128

startup/00-base.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# Xiang Wang <ramwin@qq.com>
4+
5+
6+
import datetime
7+
import logging
8+
import os
9+
import time
10+
11+
from pathlib import Path

startup/10-third.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# Xiang Wang <ramwin@qq.com>
4+
5+
6+
import redis
7+
from redis import Redis

startup/README

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
This is the IPython startup directory
2+
3+
.py and .ipy files in this directory will be run *prior* to any code or files specified
4+
via the exec_lines or exec_files configurables whenever you load this profile.
5+
6+
Files will be run in lexicographical order, so you can control the execution order of files
7+
with a prefix, e.g.::
8+
9+
00-first.py
10+
50-middle.py
11+
99-last.ipy

0 commit comments

Comments
 (0)