🌸 Sun, Nov 10, 2024 🌸

There is an issue with connection reusing in curl multi, not sure if I am doing something wrong or if there is a bug in libcurl. Currently, I work around it by just disabling the connection reuse. curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);


🌸 Fri, Nov 8, 2024 🌸

I am working on a new project, and the default character return for source code files is set to the DOS style. That gave Emacs some measles disease, filling the screen with bright red ^M symbols. To investigate, I placed the cursor on ^M, pressed Alt+X, and ran describe-char, which gave me the following information:

             position: 5358 of 144784 (4%), column: 2
            character: RET (displayed as RET) (codepoint 13, #o15, #xd)
              charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x0D
               script: latin
               syntax:       which means: whitespace
             to input: type "C-x 8 RET d" or "C-x 8 RET CARRIAGE RETURN (CR)"
          buffer code: #x0D
            file code: #x0D (encoded by coding system utf-8-unix)
              display: no font available
       hardcoded face: escape-glyph

Character code properties: customize what to show
  old-name: CARRIAGE RETURN (CR)
  general-category: Cc (Other, Control)

There are text properties here:
  font-lock-face       magit-diff-added-highlight
  keymap               [Show]
  magit-section        [Show]

[back]

So, the escape-glyph face was being used. Next, I typed customize-face, searched for escape-glyph, changed the color, and clicked on the Apply and Save button.


🌸 Thu, Nov 7, 2024 🌸

What am I doing with my life? I make AI to write code, and spend tons of time debugging and reviewing the code. And AI also blames me for writing bad code. The world is upside down. What if I write messy code and AI reviews it and fixes bugs? Can we arrange that?


🌸 Wed, Nov 6, 2024 🌸

A Thought Experiment: Simplifying C++ Function Calls with Structs (C++20)

Ever dealt with a C++ function that has too many parameters, most of which are optional? Here’s an example:

auto llm(
    ChatCompletionsQuery,
    int npredict = 2048,
    float temperature = 1.f,
    std::vector<std::string> stopTokens = {}
) -> std::string;

In this case, ChatCompletionsQuery is essential, but the other parameters often use their defaults. If you just want to tweak temperature, the call can get unwieldy.

So, here’s a thought: what if we refactored to group these optional parameters into a struct? With C++20’s designated initializers, you can do this easily:

struct LlmIn {
    int npredict = 2048;
    float temperature = 1.f;
    std::vector<std::string> stopTokens = {};
};

auto llm(const ChatCompletionsQuery& query, const LlmIn& options = {}) -> std::string;

Now, you can adjust only what you need:

llm(query, {.temperature = 2.f});

Why This Might Work

  1. Cleaner Calls: Override only the parameters you need, keeping calls concise.
  2. Future-Friendly: If more options get added, they just go in the struct.
  3. One-Stop Defaults: Set all defaults in one place for easy updates.

I haven’t tried this yet, but it seems like a clean way to keep code readable and flexible—if you’re working with C++20 or later. Worth a try?


🌸 Wed, Nov 6, 2024 🌸

Donald Trump won.


🌸 Wed, Nov 6, 2024 🌸

Note to future me. I take it back; I realized I have a smaller GPU, and it’s on 7.5. I want to use both. So, the command to build whisper.cpp on my laptop is.

CUDA_DOCKER_ARCH=compute_75 GGML_CUDA=1 make -j

🌸 Mon, Nov 4, 2024 🌸

Command to build whisper.cpp on my laptop. Note for future me.

CUDA_DOCKER_ARCH=compute_86 GGML_CUDA=1 make -j

🌸 Mon, Nov 4, 2024 🌸

Why do we call things headless, usually there is a head, but no body. Like headless Git, it has everything except the working tree. Or a headless VM, it has the brains but no visual representation. Maybe ‘faceless’ would be a more appropriate term?


🌸 Mon, Nov 4, 2024 🌸

Do you remember that I complained about Bank of America about a month ago? They sent an email that looked suspiciously scammy. And I needed to double-check if it was a legitimate email. They asked me to verify my personal data, my name, date of birth, and so on. I did it a month ago, and they still froze my credit cards. LUL


🌸 Fri, Nov 1, 2024 🌸

Not fond of that: std::numbers::pi_v<float>. Too long for simple humble π.


🌸 Wed, Oct 30, 2024 🌸

Time is hard. My approach to the problem. Internally, time is always in the UnixTime format, which might be a number of seconds, or if more resolution is needed, it might be in milliseconds, microseconds, or even nanoseconds. Sometimes we may have an integer overflow, so we can go to monotonic time, but first, try UnixTime. And carry it everywhere, and convert it to a human-readable format as close to the user, probably on the frontend side. Try to avoid saving HH, MM, SS and convert them immediately to UnixTime. Still hard, though. For example, scheduling a meeting at 10AM every day - daylight saving - BOOM! - problems.


🌸 Tue, Oct 29, 2024 🌸

I set tabs to be 3 spaces, so I can relatively easily detect if we have source code with mixed-up spaces vs tabs.


🌸 Tue, Oct 29, 2024 🌸

Yesterday, I pulled my back.


🌸 Sat, Oct 26, 2024 🌸

It took one week and one day without long COVID symptoms from last Friday until today, Saturday. Chest pain is starting now.


🌸 Sat, Oct 26, 2024 🌸

My sense of smell is slowly returning. Initially, I lost my sense of smell due to COVID, and subsequently, long COVID. I thought it was not a big deal, mostly I missed the smell of coffee, but it’s nice to be able to smell familiar smells of the house when I return home, or the change of smell outside because it’s fall, even in Southern California, you can smell different seasons.


🌸 Sat, Oct 26, 2024 🌸

Developers love to latch onto the latest “magic bullet” solutions—object-oriented programming, functional programming, data-driven techniques, design patterns, test-driven development, continuous integration, continuous deployment, memory safety, rapid development, extreme programming, unit tests, functional tests, AI-assisted coding—you name it. There’s a common belief that mastering any one of these will solve all their problems. Newsflash: It won’t.

I’m not saying these practices aren’t valuable; they are. But here’s the harsh truth: no methodology or tool can replace the hard work of actually thinking about the problem, understanding the nuances, and applying your experience. I’ve seen developers slap on design patterns like they’re checkboxes to tick, or rely on AI to generate code without a second thought, only to end up with messy, unmaintainable solutions.

That’s why I love C++. It’s a language that doesn’t let you off easy—it forces you to think deeply. Being multi-paradigm, C++ allows you to blend these practices directly in the code, but it’s up to you to choose the right approach for the right problem. You want to do object-oriented design while optimizing for performance? C++ lets you do that. You want to mix functional programming with low-level memory management? Go for it. But the language won’t hold your hand or cover up bad decisions.

So, yes, use these methodologies, embrace AI tools, and learn the latest techniques. But don’t fool yourself into thinking they’ll save you from having to think hard and make tough decisions. In the end, it’s your brain and your experience that matter the most. Everything else is just a tool.


🌸 Fri, Oct 25, 2024 🌸

I asked ChatGPT to generate a productivity mantra based on the Sith Code:

  1. Tasks are a lie.
    Challenge their necessity; reject pointless obligation.

  2. If you can avoid a task, avoid it.
    Value your time and energy as precious resources.

  3. If avoidance fails, delegate.
    Recognize that others may take on what does not require your focus.

  4. If delegation fails, automate.
    Embrace systems and tools that free you from repetition.

  5. If all else fails, do the task.
    Approach only the unavoidable with intention and efficiency.

The system shall liberate me.


🌸 Fri, Oct 25, 2024 🌸

I wish I could quit. Can someone hire me? I am so frustrated with SVN; simple things like getting the three dots diff between branches turn into impossible tasks.


🌸 Fri, Oct 25, 2024 🌸

I don’t use perfect forwarding often and always forget to put Args std::forward<Args>(args)... Just a reminder for the future me.

template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args)
{
    return std::unique_ptr<T>(
        new T(std::forward<Args>(args)...));
}

🌸 Thu, Oct 24, 2024 🌸

DejaVu Sans Mono is the best mono font. I periodically try to jump from it, but I cannot find a better font.


🌸 Thu, Oct 24, 2024 🌸

After $260, the washing machine is fixed.


🌸 Thu, Oct 24, 2024 🌸

I need to slow down, just record ideas and focus on my game.


🌸 Wed, Oct 23, 2024 🌸

With AI-assisted code, I’ve been wondering what’s more optimal and also more enjoyable. On one hand, it feels great when AI generates code that, with just a couple of tweaks, works well enough for me to start iterating. But it often misses edge cases, which can lead to a lot of frustration. For example, just yesterday, I was using the new ChatGPT o1 model with Cursor (which is basically a clone of Visual Studio Code that uses LLMs for code assistance). I was bouncing between Cursor for AI changes and Emacs for making bigger manual edits. I had some AI-generated code that made a simple video by grabbing an OpenGL buffer and encoding it using ffmpeg. Things were going smoothly until, all of a sudden, the code just stopped working.

I spent hours scratching my head, trying to figure out what went wrong. Turns out, the AI-generated code had a sneaky bug; it wasn’t flushing the decoder at the end, so a couple of seconds of the video were missing. It was the kind of bug that’s easy to miss, especially in my AI-generated podcasts, where I didn’t even notice that 2 seconds were cut off in a 40-minute episode. But yesterday, I was doing something else, and that missing bit mattered.

There’s this sweet instant gratification when the AI spits out something that works right away, but then, the debugging hits hard. It’s like a rollercoaster. I thought, “This is it! Humanity can relax; AI is here to take over.” But nah, it’s not a silver bullet. I still ended up spending too much time debugging instead of just writing it myself. I keep thinking there must be a balanced approach, but I haven’t quite figured out where to draw the line yet.

To be honest, I prefer writing code that’s already solid, bug-free (if that’s even possible), and easy to debug. I like adding tons of debug output logs, safety checks, error handling—things that AI doesn’t really think about. Debugging is just… not fun. I want the code to work right from the start, not to spend hours playing detective on an AI’s half-baked output.

In the end, I’m torn. I love not having to write all the boilerplate code, but the constant back-and-forth between Cursor and Emacs, tweaking AI-generated code, then manually fixing it—it’s a lot. It’s fun, but also frustrating, and I’m not sure if AI-assisted coding is where it needs to be just yet.


🌸 Mon, Oct 21, 2024 🌸

The washing machine broke. 😦


🌸 Sun, Oct 20, 2024 🌸

Note: alpha = opacity; 1 is equivalent to full opacity, 0 is fully transparent.


Previous - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - 37 - 38 - 39 - 40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 - 48 - 49 - 50 - 51 - 52 - 53 - 54 - 55 - 56 - 57 - 58 - 59 - 60 - 61 - 62 - 63 - 64 - Next