John Hartquist's Avatar

John Hartquist

@johnhartquist.com.bsky.social

rust // python // machine learning // audio

31 Followers  |  31 Following  |  8 Posts  |  Joined: 14.11.2024  |  1.4912

Latest posts by johnhartquist.com on Bluesky


real-time audio visualization demo built with rust (ratatui + cpal)
YouTube video by John Hartquist real-time audio visualization demo built with rust (ratatui + cpal)

latest #rust + audio experiment: real-time audio visualization in the terminal using cpal, ratatui, & realfft crates

youtu.be/XldKv1vuH0g

01.07.2025 23:33 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

I use a `justfile` to make it easy for the agent to run commands exactly how I want them.

Sometimes I add the GitHub Copilot agent as a reviewer to PRs to mix up the feedback.

I've been using LLMs for a while, but now I'm going all in.

27.05.2025 16:21 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

I've been using the new Claude Code GitHub Actions to have Claude
- take a first pass at implementations directly from GitHub issues
- address PR comments and push changes directly to PR branch
- research and discuss tradeoffs of various approaches, and make recommendations

27.05.2025 16:21 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

- when adding dependencies, use `cargo add` to get the latest version of a crate
- look up crate documentation on docs.rs when integrating newer crates
- break up large changes into smaller ones, going step by step
- explain every step at a high level to a professional software engineer

27.05.2025 16:21 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

I use Claude Code (Sonnet 4) with the following directives in CLAUDE.md:
- ensure `cargo check` passes after completing every step
- run `cargo test`, `cargo clippy` and `cargo fmt` before committing anything, and explain any test failures (if expected)

27.05.2025 16:21 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
fn check_let_else(value: Option<u8>) -> bool {
    let Some(n) = value else {
        return false;
    };

    // additional checks on n...
    todo!()
}

fn check_if_let(value: Option<u8>) -> bool {
    if let Some(n) = value {
        // additional checks on n...
        todo!()
    } else {
        false
    }
}

fn check_match(value: Option<u8>) -> bool {
    match value {
        Some(n) => {
            // additional checks on n...
            todo!()
        }
        None => false,
    }
}

fn check_let_else(value: Option<u8>) -> bool { let Some(n) = value else { return false; }; // additional checks on n... todo!() } fn check_if_let(value: Option<u8>) -> bool { if let Some(n) = value { // additional checks on n... todo!() } else { false } } fn check_match(value: Option<u8>) -> bool { match value { Some(n) => { // additional checks on n... todo!() } None => false, } }

In today's #adventofcode solution using #rustlang, I used a "let-else" statement to
- conditionally declare a variable
- return early
- avoid indenting the remaining checks (as in the other examples)

I prefer returning early and using the implicit return for the "happy path". What do you think?

04.12.2024 23:24 โ€” ๐Ÿ‘ 6    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Bacon Bacon, a background compiler for Rust

I love running `bacon` in a separate terminal window so I can see how many errors/warnings I have in real-time: dystroy.org/bacon/

22.11.2024 21:23 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Rust is a great language to pair program with an LLM.

The precise type system makes it easy to communicate about code at a functional level, and powerful tooling make it trivial to spot and understand the inevitable errors BEFORE executing anything.

#rustlang

20.11.2024 00:04 โ€” ๐Ÿ‘ 4    ๐Ÿ” 0    ๐Ÿ’ฌ 2    ๐Ÿ“Œ 0

@johnhartquist.com is following 20 prominent accounts