The Elegance of the Hedgehog

/media/images/elegance_of_the_hedgehog.jpg

While looking for audiobooks at the local library I came across The Elegance of the Hedgehog. The synopsis sounded interesting, and I looked up the print copy to sample some of the prose. I was pleased to see the novel didn't contain overly depressing situations, right wing assholes, or salacious gore. It's about a concierge in an upscale apartment building who spends her life hiding her intelligence from her rich patrons until a gifted young girl and a Japanese gentleman uncovers her secret.

The novel is by Muriel Barbery, a French teacher of philosophy and the characters spend most of their time in internal reflection. A product of French culture, I found the story sentimental and with an ending that was so stereotypically French I laughed out loud when it happened but I still enjoyed the book. I read it in print instead of as an audiobook because of the density of the prose but I think I might go back and get the audiobook to listen to it again. In 2009, they made a movie based on the book: The Hedgehog and I suppose there's an outside chance the library has this too.

Look Back

/media/images/look_back01_udcywho.png

Look Back by Tatsuki Fujimoto is about a young girl in fourth grade who is proud of her role as the manga artist in her class newspaper.

/media/images/look_back02_gbckidt.png /media/images/look_back03.png

Another classmate, a recluse that avoids school sends in their artwork and she's stunned to discover it is significantly better than her own.

/media/images/look_back04.png /media/images/look_back05.png

She works harder and her artwork improves but her social life suffers but when she sees another example of her reclusive classmate's work she realizes it's hopeless and gives up.

/media/images/look_back06.png /media/images/look_back07.png

At the end of the year her teacher asks her to take something to the home of this reclusive classmate. She objects at first but then goes to her classmate's house and slips a quickly scribbled little comic about wanting her to come out under the door. As she's leaving her classmate comes running out and confronts her.

/media/images/look_back08.png /media/images/look_back09.png

Her classmate says as soon as she saw the scribbled cartoon she she knew who it was, that she's a big fan, and she's been eagerly reading her comics over the years. Stunned by this news, she lies and tells the reclusive girl the reason she stopped drawing is because she was working on a big idea for a contest.

/media/images/look_back10.png /media/images/look_back11.png

The next few panels are the reason I'm making this post. This girl was proud of her skills, crushed by the realization there are others with greater talent, had given up, and then her pride dragged her back in. The panels following this revelation don't have any dialog but you can see her anguish and pride.

/media/images/look_back12.png /media/images/look_back13.png

The plot continues but this really is the moment that makes the whole comic shine. The artist behind this one-shot, Tatsuki Fujimoto is the same artist that did chainsaw man.

Albert's Path is strange and difficult

Spellchecker in Helix

/media/images/grav_labs_helix_multi_kit_pipe.jpg

An image search for 'helix pipe' returned a bunch of images of whatever this is

There's currently no official support for spellchecking in helix but it supports the LSP protocol and there are tools that will provide spelling and grammar checking over LSP. I've setup my editor to use ltex-ls. It's slow (written in java) and it won't actually fix the spelling but it's better than nothing until we get official support. Here's how I set it up.

Start by downloading and unzipping the application.

Then modify your .config/helix/languages.toml with this (using your path to the ltex-ls binary):

[[language]]
name = "markdown"
language-servers = [{ name = "ltex"}]
soft-wrap.enable = true
soft-wrap.wrap-indicator = ""
# scope = "source.markdown"
file-types = ["md", "txt", "tex"]

[language-server.ltex]
command = "/home/na/app/ltex-ls/bin/ltex-ls"

Restart helix and it should automatically start loading the LSP (you'll see a spinner in the status bar).

By default ltex-ls is set for american english but you can set other langues like this.

This was taken from a blog post that talks about setting up a note taking app in helix.

Debugging rust in helix

/media/images/helixforward-helix-piercing.jpg

An image search for helix produced a bunch of pictures of ears

This is cool and the existing documentation isn't super clear. I wanted to debug some unit tests in a script I was writing. Rust provides a gdb debugger with the ability to pretty print rust objects called rust-dbg. Run it from the command line like normal with:

rust-gdb target/debug/rename_files

Unfortunately unit tests like this:

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn crop_start() {
        let filename = "1234567890";
        let newfilename = crop_filename(filename, 1, 0, false).expect("failed to crop");
        assert_eq!("234567890".to_string(), newfilename);
    }

    #[test]
    fn crop_end() {

aren't normally compiled and linked into your binary but you can get a path to this binary with 'cargo test':

~/source/rust/rename_files  cargo test                                                                                   3m 51s
    Finished test [unoptimized + debuginfo] target(s) in 0.02s
     Running unittests src/main.rs (target/debug/deps/rename_files-26e38ab9001eb8c3)

running 26 tests
test capitalize::tests::single_word ... ok
test capitalize::tests::space_separated_words ... ok
test capitalize::tests::three_words_one_short ... ok
test capitalize::tests::three_words ... ok
test capitalize::tests::three_words_start_short ... ok
test capitalize::tests::two_long_words ... ok
test crop::tests::crop_end_out_of_range ... FAILED

Run rust-gdb on this path to debug your unit tests.

rust-gdb target/debug/deps/rename_files-26e38ab9001eb8c3

Unfortunately this only gives you raw gdb connection and I couldn't get -tui to work but you can do your debugging directly in the helix editor. To get started configure your system.

In my case I ran:

      sudo pacman -S lldb
      cd /usr/local/etc
sudo helix lldb_vscode_rustc_primer.py

and pasted this into that file:

import subprocess
import pathlib
import lldb

# Determine the sysroot for the active Rust interpreter
rustlib_etc = pathlib.Path(subprocess.getoutput('rustc --print sysroot')) / 'lib' / 'rustlib' / 'etc'
if not rustlib_etc.exists():
    raise RuntimeError('Unable to determine rustc sysroot')

# Load lldb_lookup.py and execute lldb_commands with the correct path
lldb.debugger.HandleCommand(f"""command script import "{rustlib_etc / 'lldb_lookup.py'}" """)
lldb.debugger.HandleCommand(f"""command source -s 0 "{rustlib_etc / 'lldb_commands'}" """)

Finally I updated my languages.toml file with:

[[language]]
name = "rust"

[language.debugger]
name = "lldb-vscode"
transport = "stdio"
command = "lldb-vscode"

[[language.debugger.templates]]
name = "binary"
request = "launch"
completion = [ { name = "binary", completion = "filename" } ]
args = { program = "{0}", initCommands = [ "command script import /usr/local/etc/lldb_vscode_rustc_primer.py" ] }

I reloaded my config with ':config-reload' and then in helix I used '<Space> g' to bring up the debugger menu and 'b' to set a breakpoint on a particular line of code (in my unit test).

Then 'l <Enter>' to tell it to run a binary in the debugger and I gave it the path to the compiled binary with linked in unit tests:

And that's it. It automatically ran the script, stopped at my breakpoint and let me inspect values. It's still primitive but having this all already built into the editor without any plugins or super weird configuration is nice.

fal.ai real time image generation

This is impressive

/media/images/fast_image_generation.png