chrisphan.com

Mastodon posts for 2025-W45

An analog clock reading 8:45 

Categories: Mastodon

Spending my morning helping out with a @thecarpentries workshop. It's a great organization that teaches people to use tools such as , , and the

— Chris Phan,

Today in silly 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
Terminal screenshot. User entered the command  cat shopping_list_2025-W45.md . In response, the computer outputted the contents of a Markdown-formatted shopping list:  # Shopping list for 2025-W45  * bread * almond milk * yogurt * fruit * carrots * mushrooms * beets * ground pork * bacon * mozzarella * ricotta * cheddar * vegetable oil * frozen spinach * garbanzo beans  Then the user entered the command  cat shopping_list_2025-W45.md | cool_text.py   The computer responded similarly as above, except that every letter was capitalized and shown using the outline letters from the Symbols for Legacy Computing Supplement Unicode block.

— 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.

— Chris Phan,

It's called trim in Rust. 🤷‍♂️

docs.python.org/3/library/stdt

doc.rust-lang.org/std/primitiv

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'?

— 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!

bluff.coop/event/fermentation-

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 in a little while!

A glass canning jar stuffed with wet green cabbage. On top is a metal lid and rim. The jar sits on a wood table next to a lime green wall. A window sill can be seen in the background.

— Chris Phan,