Skip to content

Instantly share code, notes, and snippets.

View phedoreanu's full-sized avatar
🏠
Working from home

Adrian Fedoreanu phedoreanu

🏠
Working from home
View GitHub Profile
@rain-1
rain-1 / a_How is a matrix used to count fish?.md
Last active August 1, 2024 14:29
How is a matrix used to count fish?

This is explaining stuff relevant to AOC 2021 day 6

How is a matrix used to count fish?

First lets do fibonacci numbers because it's smaller (2x2 matrix instead of 9x9) and it's familiar ground.

So you can implement fibs like this:

def fib(n):

sharing this oneliner i made and use a lot on PEs. doesn't work on DLLs or if you have 0 imports:
alias peinfo="python -c \"import pefile, sys; pe = pefile.PE(sys.argv[1]); print('\\n'.join(['Module: {} - {}, Address: {}'.format(entry.dll.decode('utf-8'), imp.name.decode('utf-8'), hex(imp.address)) for entry in pe.DIRECTORY_ENTRY_IMPORT for imp in entry.imports]))\""
sample output:

Module: KERNEL32.dll - DeleteCriticalSection, Address: 0x14000d1d8
Module: msvcrt.dll - __initenv, Address: 0x14000d270
Module: msvcrt.dll - calloc, Address: 0x14000d2e8