Skip to content

Instantly share code, notes, and snippets.

View Joeccp's full-sized avatar
😀
Working from home

JoeGor Joeccp

😀
Working from home
View GitHub Profile
@Joeccp
Joeccp / iseven.py
Last active April 4, 2024 14:25
isEven() alternatives with extream job safety
"""
This file contains isEven() alternives.
Just kidding, don't actually use these :)
(C) 2024 Joe Chau. Released under the MIT License.
"""
@(e := __import__('typing')).no_type_check
@e.final
@__import__('functools').cache
@Joeccp
Joeccp / hexdump.py
Created March 10, 2024 02:18
My hexdump in Python
"""
hexdump in python
`python hexdump.py -h` to see usage
"""
from typing import *
CONTROL_CHARACTERS_REPRESENTATION_IN_CONTROL_PICTURE: Final[dict[int, str]] = {
0: '\N{Symbol For Null}',
@Joeccp
Joeccp / sudoku_generator.py
Last active January 5, 2024 04:23
Generate shuffed 9x9 sudoku
"""
Sudoku generator
Algorithm shamelessly borrowed from https://stackoverflow.com/a/56581709/16747758 (By Alain T., released under CC-BY-SA 4.0)
"""
from itertools import product, batched, chain
from typing import *
from random import sample
@Joeccp
Joeccp / find_in_nd_array.py
Last active January 4, 2024 04:32
Python find element index in N-D array
from typing import *
from operator import eq
def find_in_nd_array(array: Iterable,
value: Any,
function: Callable[[Any, Any], bool] = eq,
__prefix_indexes: tuple[int, ...] = tuple()
) -> tuple[int, ...]:
"""
aahed
aalii
aapas
aargh
aarti
abaca
abaci
aback
abacs
abaft