Spending my morning helping out with a @thecarpentries workshop. It's a great organization that teaches people to use tools such as #Python, #git, and the #Unix #shell
— Chris Phan,
Today in silly #python scripts
![Terminal screenshot. User entered command bat ~/.config/misc_scripts/cool_text.py . In response, the computer displayed the source code for a Python script: #!/usr/bin/env python3 import string import fileinput from typing import Final Change text for stdin, replacing ASCII letters with corresponding outline letters. Example: `$ cat example.txt | cool_text.py` DIFFERENCE: Final[int] = ( 0x1CCD6 # codepoint for Outlined Latin Capital Letter A - 0x41 # codepoint for 'A' ) def transform(x: str) -> str: Transform all ASCII letters to the corresponding outlined letters. if len(x) == 1: # Transform of a single character if x in string.ascii_uppercase: return chr(ord(x) + DIFFERENCE) elif x in string.ascii_lowercase: return chr(ord(x.capitalize()) + DIFFERENCE) else: return x else: # Call this function for every character in x return .join(transform(c) for c in x) if __name__ == __main__ : try: for line in fileinput.input(): print(transform(line), end= ) except KeyboardInterrupt: # Supress printing of traceback if user quits with ^C pass](/masto_pics/115503873815105571_0.png)

— Chris Phan,
To be clear, I don't think you should actually post this kind of output anywhere, because of the potential problems it poses to screen readers. #a11y
— Chris Phan,
It's called trim in Rust. 🤷‍♂️
https://docs.python.org/3/library/stdtypes.html#str.strip
https://doc.rust-lang.org/std/primitive.str.html#method.trim
![Terminal screenshot, Python traceback (I've omitted the line that is just carets underneath the previous line): Traceback (most recent call last): File /Users/chris/Documents/projects/sandbox_3/unidecoder/category_dict/make_gc_dict.py , line 10, in <module> code = parts[1].trim() AttributeError: 'str' object has no attribute 'trim'. Did you mean: 'strip'?](/masto_pics/115511804514123617_0.png)
— Chris Phan,
I assumed this was a conscious decision, since I imagine I am not the only person who gets trim/strip confused. But looking at the source code last night, I could not find an explicit reference to “trim” or “strip” in the suggestions code. Rather, I think it’s probably just a (really nice) coincidence, since they have the same three middle letters.
— Chris Phan,
I’m going to learn how to ferment stuff this morning!
https://www.bluff.coop/event/fermentation-class-101/
I’ve been trying to ferment food recently but have had mixed success. I successfully made some sauerkraut and pickled some celery, but my attempts with carrots or mung bean sprouts have ended up moldy.
— Chris Phan,
With any luck, this will be a jar of #sauerkraut in a little while!

— Chris Phan,