Miscellaneous functions written in short forms.
Project description
Omnitools
Miscellaneous functions written in short forms.
Hierarchy
omnitools
|---- encoding
| |---- b64
| | |---- b64d()
| | |---- b64e()
| | |---- try_b64d()
| | '---- b64d_or_utf8e()
| |---- file
| | '---- charenc()
| '---- utf8
| |---- utf8d()
| |---- utf8e()
| |---- try_utf8d()
| '---- try_utf8e()
|---- hashing
| |---- mac()
| '---- sha512()
|---- rng
| |---- randb()
| '---- randi()
|---- stdout
| '---- p()
'---- type
|---- str_or_bytes
|---- list_or_dict
|---- key_pair_format
|---- encryptedsocket_function
'---- Obj()
Example
python
from omnitools import *
# print and always flush buffer
p("abc")
# abc
#
# base64 decode
p(b64d(b64e("test")))
# test
# base64 encode
p(b64e("test"))
# dGVzdA==
# try b64d str except return itself
p(try_b64d("test"))
# test
# try b64d str except utf8e str
p(b64d_or_utf8e(randb(64)))
# b"..."
# detect character encoding
p(charenc(b"\xe3\x81\x82"))
# utf-8
# utf8 decode
p(utf8d(utf8e("test")))
# test
# utf8 encode
p(utf8e("test"))
# b"test"
# try utf8d bytes except return itself
p(try_utf8d("test"))
# try utf8e str except return itself
p(try_utf8e(randb(64)))
# hash mac with hmac, sha3_512
p(mac(content="test", key=randb(64)))
# ...
# hash with sha3_512
p(sha512("test"))
# ...
# generate random 64 bytes
p(randb(64))
# b"..."
# generate int from 10**power to 10**(power+1)-1
p(randi(power=2))
# 101 # from 100 to 999
# turn (nested) dict into an object
p(Obj({"a":{"b":{"c":123}}}).a.b.c)
# 123
shell
rem omnitools.exe <function name> [argument] ...
omnitools.exe p abc
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
omnitools-0.0.50.tar.gz
(4.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omnitools-0.0.50.tar.gz.
File metadata
- Download URL: omnitools-0.0.50.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5045293bc415b152dc994b01db0b93884187b00f915fba5a8a5ae82c0a2f2e6c
|
|
| MD5 |
0865c34f294d84053862ac86a592baff
|
|
| BLAKE2b-256 |
cacba6e23c8f449162b2bc80327cc9b5d557417bd5aa2e166c728e8e0edd805c
|
File details
Details for the file omnitools-0.0.50-py3-none-any.whl.
File metadata
- Download URL: omnitools-0.0.50-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe2f6d74b949f34e0123e849ae39e8a7b06619412bc3c74e37e709cc7fc2c8b0
|
|
| MD5 |
db7e599a2ad335957b8b868a5c28d923
|
|
| BLAKE2b-256 |
747f87ac4bc871f17344bf2d25c5d220ac00514762ce9e47bbbd50d2837c9281
|