useful python things
Project description
useful python things
add class
class _type_sign(Enum):
SIGN=1
UNSIGN=2
env
from pyeco import *
from pyeco import _type_sign
function: dec2hex(_dec,_nbits)
_dec -> input decimal:
8 bits[-128,127],
16 bits[-32768,32767],
32 bits[-2147483648,2147483647]
_nbits -> _dec's number bits: 8,16,32
output -> dec to hex format
example:
print(dec2hex(-127,8))
function: hex2dec(_hex,_nbits,_s)
_hex -> input hex:
_nbits -> _dec's number bits: 8,16,32
_s -> _type_sign.UNSIGN/_type_sign.SIGN output decimal
output -> hex to decimal format
example:
print(hex2dec(0x81010181,32,_type_sign.UNSIGN))
function: dec2bin(_dec,_nbits)
_dec -> input decimal
_nbits -> _dec's number bits: 8,16,32
output -> dec to binary format
example:
print(dec2bin(-128,16))
function: bin2dec(_bin,_nbits,_s)
_bin -> input binary:
_nbits -> _dec's number bits: 8,16,32
_s -> _type_sign.UNSIGN/_type_sign.SIGN output decimal
output -> bin to decimal format
example:
print(bin2dec("11111111111111111111111110000000",32,_type_sign.UNSIGN))
function: hex2bin(_hex,_nbits)
_hex -> input hex:
_nbits -> _dec's number bits: 8,16,32
output -> hex to binary format
example:
print(hex2bin(0x81010181,32))
function: bin2hex(_bin,_nbits)
_bin -> input hex:
_nbits -> _dec's number bits: 8,16,32
output -> binary to hex format
example:
print(bin2hex("1100000000000011",16))
env
from pyeco import *
from pyeco import _adr_size
bindiff(_file1,_file2,_nbits,_size,_flag,_base_adr)
_file1 - first file,
_file2 - second file,
_nbits - word's number bits: 8,16,32,
_size - how much words to compare
_flag - screen adress by _nbits words or bytes
_base_adr - base adress, need for real dats location
output -> binary difference between _file1 and _file2
example:
bindiff("e:/spil.bin","e:/u-boot.bin",32,int(0xce0/4),_adr_size.BYTE,0xe6300000)
env
from pyeco import *
function: max_array(in_array)
in_array - входной массив
output -> вычисляет MAX значение числа из массива in_array и выводит на консоль
example:
import numpy as np
in_array = np.array([-176,3,148,-10,36,238,-76])
max_array(in_array)
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
pyeco-0.5.tar.gz
(3.3 kB
view details)
Built Distribution
pyeco-0.5-py3-none-any.whl
(4.3 kB
view details)
File details
Details for the file pyeco-0.5.tar.gz
.
File metadata
- Download URL: pyeco-0.5.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.0 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4860879ef5949ad2112b3cd1f69a5f65a7c2314ef6c570c76e0e5156a325c66 |
|
MD5 | abe45489fa07c060b48d35dd87cc643c |
|
BLAKE2b-256 | 9ec68a9a2b6e3052137b870630e5de32a37f946af55e87991d05782263a3a7e3 |
File details
Details for the file pyeco-0.5-py3-none-any.whl
.
File metadata
- Download URL: pyeco-0.5-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.0 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 762d1197b2db77ef2f3ca126dd4f8c95968d4da5ec687dfd7b4a13bd6d1f0764 |
|
MD5 | 1545fe2393d1fe79816a820bc2b5aea2 |
|
BLAKE2b-256 | db0786202c32a6f40e75fe3fb6452cd0f586646555c4acb467a3642650a6f8ce |