Skip to content

Instantly share code, notes, and snippets.

View shpigunov's full-sized avatar
🎯
Focusing

Anton Shpigunov shpigunov

🎯
Focusing
View GitHub Profile
@shpigunov
shpigunov / batching.py
Created October 9, 2022 14:37
Creating batches with Python
"""
This is a study on the fastest way to split an iteralbe (list) into batches of a set size.
Note that this study omits attempts parallelization and does not use generators.
"""
from typing import List
from itertools import islice
def batch(iterable: List, batch_size: int) -> List[List]:
res = []
@shpigunov
shpigunov / ruiner_bin.py
Created October 10, 2018 18:40
RUINER bin read and write
def write_bin(s):
return ' '.join(format(ord(x), 'b') for x in s)
def read_bin(s):
return ''.join([chr(int(c, 2)) for c in s.split()])
read_bin("01010100 01110101 01100101 01110011 01100100 01100001 01111001")
write_bin("Tuesday")

Keybase proof

I hereby claim:

  • I am shpigunov on github.
  • I am shpigunov (https://keybase.io/shpigunov) on keybase.
  • I have a public key ASCtXFSaFxZG16ocragMYrfUZSyCBlE_zdxU1B5qjwlfIwo

To claim this, I am signing this object: