TIL
content
parsing yaml might cause security vulnerabilities
- yaml allows code execution in parsing
- yaml can have deep nested attributes, causing parser to consume compute resources and leading to DoS
in less, type / to search, then press -i to toggle case sensitivity
- e.g.,
/pathfinds allpath, pressing-ifindspath/Path/PATH/....
iptables is just a program to configure firewall rules, it’s not a different thing from firewall
- it’s deprecated but still widely used,
nftablesis the successor.
firewalld is written in python
TTY options makes the process think it’s running in a terminal, which enables proper terminal behavior
- coloring, formatting, cursor positioning, ctrl-z/c (signal handling)
docker exec -iopens interactive stdindocker exec -itgives stdin and above mention stdout benefits
a process can be disowned
- run
sleep 1000followed bydisown, nowsleepwill persist after shell is closed disownremoves child process from shell’s child process table, so when shell exits, said child process will not receiveSIGHUP
Dict key in Python can’t be mutable object because of hash
- key is being hashed with a salt when a key is added to a dict
- dict key can’t be immutable object with mutable object inside either, e.g.,
(1, [2, 3]) - The Python Dictionary Object — A Peek Under the Hood
python’s self is just a convention, any word works
class MyClass:
def __init__(me, name):
me.name = name
def get_name(hi):
return hi.name
c = MyClass("hi")
print(c.get_name())Go’s go keyword is analogous to & at the end of shell commands
go MyFunc()in Go ~=MyFunc() &in shell scripts
SIGHUP
- signal, hang up
- it’s usually used a signal to process to reset, reload config
- can be caught, or ignore by the program
SIGTERM→ graceful shutdownSIGKILL→ force stop
localhost, 127.0.0.1, and 0.0.0.0
-
localhostmaps to127.0.0.1and::1(IPv6)- the three are the same thing
-
127.0.0.1is the loopback address- it means “only this machine”
- if something is on
127.0.0.1:5173, it’s only accessible from this machine
-
0.0.0.0is the wildcard address- it means all IP addresses
-
more practical examples
- a remote machine has a web app on
127.0.0.1:8080, it can’t only be accessed from the machine - a remote machine has a web app on
0.0.0.0:8080, and the machine has a tailscale IP of100.84.151.31, the web app can be accessed from100.84.151.31:8080
- a remote machine has a web app on
-
when i run
bun run dev --host 0.0.0.0, i see:
➜ Local: http://localhost:5173/
➜ Network: http://10.65.117.113:5173/
➜ Network: http://100.84.151.31:5173/
➜ Network: http://192.168.64.1:5173/
➜ press h + enter to show help
- which means, the machine has 3 different network interfaces, and they can all access the web app