Friedrich Ewald My Personal Website


  • Ruby Testing Server Part Two

    Following from my post from 2022 about testing Rails application with a static server, I wanted to mock an API during a test. The reason for this is that I like to keep the external dependencies to a minimum.

    Continue reading

  • July 4 2023

    Golden Gate Bridge in San Francisco, CA on 4th of July weekend Happy 4th of July from San Francisco!

  • Bread recipe

    I made my first bread today from scratch. The recipe is very simple:

    1. 430 grams flour (King Arthurs bread flour)
    2. 2 teaspoons coarse salt
    3. 1 bag (6-7 grams) of instant yeast
    4. 1 1/2 cups of water
    Mix everything gently together in a bowl until the dough becomes sticky. Then proof at 95 Fahrenheit for 1 hour until the dough doubles in size. Preheat the oven to 475 Fahrenheit and bake for 20 minutes. Bread in the oven The results were good for a first attempt, but I will try to proof for 2 hours next to achieve fluffier results. Bread after cutting

  • Memory profiling with Memray

    I am currently working on a small Python project with a relatively large memory footprint. I wanted to analyze the usage in detail and realized that I wasn’t aware of any good Python memory profiler. After some searching I found the builtin package tracemalloc (Trace memory allocation). Especially interesting to me is the capability to take snapshots at different points in time and then compare the delta between those snaphots. The following snippet illustrates this.

    import numpy
    import tracemalloc
    snapshot_before = tracemalloc.take_snapshot()
    array = numpy.zeros((100, 100))
    array2 = numpy.random.rand(1_000_000, 1_000)
    array3 = array2.astype(numpy.float16)
    snapshot_after = tracemalloc.take_snapshot()
    stats = snapshot_after.compare_to(snapshot_before, 'lineno')
    for s in stats[:10]:
    This is fine for smaller code bases where I have full control over the source. It requires however a lot of editing and manual filtering of frames and taking snapshots at the right time. Another interesting solution is Bloombergs memray. This allows to run a whole Python application and save the snapshots into a file. From there memray can either create a table or a flamegraph to see the memory consumption over time. Memray can be used like this:
    pip3 install memray
    # Run application and save snapshots
    memray run
    # Display snapshots
    memray flamegraph
    This generates a HTML file which can be opened in any browser.

  • Updating Jekyll to Ruby 3.2.0

    I recently updated this blog to Ruby 3.2.0 which was released on Dec 25, 2022. I expected this to be a minor update since I came from Ruby 3.1.2. However, I ran into some problems that I had to solve.

    Continue reading

Previous Page: 1 of 28