TWIL 002
TWIL ~ This week I learned"
AoC day 10:
Day 10 of 2023 led me to discover two new tools/algorithms for working with polygons. Pick’s theorem to count integer points inside polygon. Shoelace formula to calculate area of polygon.
Joining sets
which I always forget!
# Quick Examples
# Join using |
myset = myset1 | myset2 | myset3
# Join using union()
myset = myset1.union(myset2,myset3)
# Join using + operator
myset = set(list(myset1) + list(myset2))
# Join using update()
myset.update(myset1,myset2)
Linux snippets
What process is running on PORT
netstat -nlp | grep PORT
Getting information about process based on PID
ps -Flww -p PID
Sorting human readable sizes
du -hd1 . | sort -h