Skip to content

Instantly share code, notes, and snippets.

View pitrk's full-sized avatar
⚛️
Keep looking up!

Piotr Matuszak pitrk

⚛️
Keep looking up!
View GitHub Profile
@pitrk
pitrk / mbedtls-errors.txt
Created July 15, 2023 11:33 — forked from erikcorry/mbedtls-errors.txt
Mbed TLS error codes
High level error codes
0x1080 PEM - No PEM header or footer found
0x1100 PEM - PEM string is not as expected
0x1180 PEM - Failed to allocate memory
0x1200 PEM - RSA IV is not in hex-format
0x1280 PEM - Unsupported key encryption algorithm
0x1300 PEM - Private key password can't be empty
0x1380 PEM - Given private key password does not allow for correct decryption
0x1400 PEM - Unavailable feature, e.g. hashing/encryption combination
@pitrk
pitrk / sharing.py
Created September 23, 2018 22:30
Is class attribute shared between threads in Python?
import threading
class SharingChecker:
number: int = 0
def increment(self) -> None:
SharingChecker.number += 1
@pitrk
pitrk / function_prints_correctly.py
Created September 19, 2018 09:48
Testing if function prints something correctly in python 3 with unittest
# Python 3.7
import io
import unittest
import unittest.mock
# -- function --
def print_hello_world() -> None:
print('Hello World!')
@pitrk
pitrk / _mock_file_with_string.md
Last active November 15, 2023 13:34
Mock file with string in Python

Mock file with string in Python

This is an example on how to mock a file with string.

Use case

Testing a function which opens a file and does some kind of operation on it.

About the example