In the middle of the desert you can say anything you want
Bitwarden-rs in now called vaultwarden.
Second time I find setting it up on Yunohost hard, so documenting.
“Create account” from main page with the yh email doesn’t work because the user allegedly exists.
ssh -v localhost is a quick way to get the versions of everything.
Here and later, ‘host’ is the thingy hidden behind NAT.
cloudflared on the server
How to see ping requests being recieved on the destination machine? - Super User:
Wireshark is too heavy duty for something so simple. Just use
tcpdump -nn icmp. Add andhost 1.2.3.4if you want to limit it to packets coming from 1.2.3.4.
Was diagnosing an intermittent internet failure, and for logging when it disappears - ping -D 8.8.8.8. -D prints the timestamps:
[1664029219.968932] 64 bytes from 8.8.8.8: icmp_seq=27 ttl=115 time=17.1 ms
[1664029220.971096] 64 bytes from 8.8.8.8: icmp_seq=28 ttl=115 time=18.0 ms
[1664029222.100859] 64 bytes from 8.8.8.8: icmp_seq=29 ttl=115 time=147 ms
[1664029222.973428] 64 bytes from 8.8.8.8: icmp_seq=30 ttl=115 time=19.4 ms
[1664029223.973696] 64 bytes from 8.8.8.8: icmp_seq=31 ttl=115 time=18.1 ms
[1664029224.990894] 64 bytes from 8.8.8.8: icmp_seq=32 ttl=115 time=33.9 ms
[1664029225.973556] 64 bytes from 8.8.8.8: icmp_seq=33 ttl=115 time=15.4 ms
[1664029226.978178] 64 bytes from 8.8.8.8: icmp_seq=34 ttl=115 time=18.5 ms
[1664029227.980347] 64 bytes from 8.8.8.8: icmp_seq=35 ttl=115 time=19.0 ms
[1664029228.989004] 64 bytes from 8.8.8.8: icmp_seq=36 ttl=115 time=26.4 ms
[1664029230.091472] 64 bytes from 8.8.8.8: icmp_seq=37 ttl=115 time=127 ms
[1664029230.982869] 64 bytes from 8.8.8.8: icmp_seq=38 ttl=115 time=18.3 ms
Have a vodafone router and a real ASUS router that does everything better, and I connect the vodafone router to it and then use the ASUS router for everything else.
Was debugging stuff and set it to AP mode - wanted to go back, but I couldn’t access the ASUS admin panel anymore at the usual 192.168.2.1.
It had a different IP, one I could find in the Vodafone router control panel, and through that found the ASUS router admin interface.
I religiously do .realpath() pretty much every time I get a path from user input. Naively believing it also expands ~ etc.
Once I forgot and once I entered a non-expanded path myself: ~/this/
Then was tracking it as a bug, and found this bundle of joy:
/home/sh/me/dir~/me/dir/Checkpoints/checkpoint_288
It is in fact not illegal to create a directory called ~ in Unix.
And the things that used it as-is where there, and the things that were using it after a realpath were using another directory.
OK, I resolve()-d it - still the same.
TIL Path.resolve() takes care of symlinks and ..-like components, but not ~. So it should be Path.expanduser().resolve() from now on.
jq’s to_entries allows parsing key names as values/fiels:
``s__` jq ’to_entries' Input {“a”: 1, “b”: 2} Output [{“key”:“a”, “value”:1}, {“key”:“b”, “value”:2}]
Documented worse than I’d like to.
Filters allow to do things to the records (structs that make up a log message later), be it change them in place or don’t let them pass.
You can pass a function in place of a Filter, it should:
logging.LogRecordThe fields of a LogRecord are the same ones we name when doing formatting: name, lineno, msg and friends.
If your Filter tries to log something in a way that it’ll get filtered through it, you get recursion.
Sample of a filter that removes specific matches and gets added to a Handler:
def filter(record: logging.LogRecord) -> int:
"""Filters away log records containing annoying stuff."""
blacklist_condition = (
(
record.name == "lib_sdk.data"
and "not available on your" in record.msg
)
or (
record.name == "lib_sdk.data"
and record.levelno == logging.WARNING
and "which is legacy" in record.msg
)
or (
record.name == "lib_sdk.data"
and record.levelno == logging.WARNING
and "created but without information" in record.msg
)
)
if blacklist_condition:
return 0
else:
return 1
sh = logging.StreamHandler()
sh.addFilter(filter)
Much better than what I had before (220914-2249 Python logging change level through context manager and operator magic).
One can go crazy here with regexes etc. but I shan’t.
Goal: log everything to file, but show only part of the info on the screen. Previously: 220914-2249 Python logging change level through context manager and operator magic
My current understanding:
format = "[%(asctime)s %(name)s:%(lineno)s %(levelname)s]: %(message)s"
# Set it up, no handlers -> no default StreamHandler
# this loglevel is the one handlers will have access to!
logging.basicConfig(
level=logging.DEBUG,
handlers=[]
)
# Format, if we don't do this will be literally none
fmtr = logging.Formatter(fmt=format)
sh = logging.StreamHandler()
fh = logging.FileHandler("debug.log")
fh.setFormatter(fmtr)
sh.setFormatter(fmtr)
# Screen output set to whatever we want, fh to debug
sh.setLevel(loglevel)
fh.setLevel(logging.DEBUG)
# Add both handlers to root, both get propagated to logger etc.
logging.getLogger('').addHandler(sh)
logging.getLogger('').addHandler(fh)
Even though i did logger = logging.getLogger(__package__) at the very top of the file before the above bits, I can do logger.debug() etc. and it follows these settings. Nice.