Hacker Newsnew | past | comments | ask | show | jobs | submit | leontrolski's commentslogin

Agreed, benchmarking, I only see a slight speedup on MacOS - https://github.com/leontrolski/postgresql-testing#:~:text=ra...

Being to lazy to think or test it - does the above reset SEQUENCEs?

actually no, and we have something weird for that too:

We have code that creates one master sequence then replaces every sequence in the testdb with that master sequence, so all tables pull from the same sequence. That way you can never accidentally swap two id's in an api response and have the tests pass because you coincidentally both had id 5 or whatever. We can run the tests either way (with sequences swapped out or not). We almost always leave the master sequence in place because the id-swap bug is very common and the alternative (bug caused by two id's being the same on different tables) basically never comes up.


I concur with this approach. TRANSACTION-y tests (the default in Django) often don't quite line up with reality and make it hard to eg. drop in a breakpoint and run a server against the test's db state.

I've experimented (see below) with TEMPLATE dbs and such in Python (with inspiration from this library). IMHO the "around 100ms" mark is pretty slow for a big test suite. Interestingly, pg_restore is only twice as slow as TEMPLATEs.

https://github.com/leontrolski/postgresql-testing

I'd be interested about how all this compares to snapshotting the postrgres dir with ZFS and restoring to that, but don't have a Linux box to hand.


Some discussion on (ab?)using pypi to distribute binaries - https://discuss.python.org/t/use-of-pypi-as-a-generic-storag...

Wherever you fall on that debate (I have my opinions but they are not strongly held), a bigger red flag here for me is the `pip install ...` opener. The fact they later have a `uvx ...` example in the docs just makes defaulting to pip even worse.

As that comment mentions:

> 5 years ago [...] Python packaging was a big mess.

> Today [...] I think Python's packaging story has never been stronger.

Poetry, & later Uv, are essential & invaluable milestones in that revolutionary story; Pip is terrible software & should be left in the past.


> Poetry, & later Uv, are essential & invaluable milestones in that revolutionary story; Pip is terrible software & should be left in the past.

The comparison to other programs is missing the point of why pip is terrible. For that matter, last I checked Poetry relied on either vendored pip or something very much like it to do the actual package installation.

If you like workflows dictated by all-in-one tools, go for it. Don't force it on me. Some of us still see great value in the Unix philosophy.

The real problem is that pip doesn't even do a good job of its "one thing" (the actual package installation). It barely understands caching, has insecure and confusing default behaviours stemming from nigh-unfixable legacy issues, doesn't know how to inspect the installation environment properly (therefore relying on ugly hacks to install cross-environment at all), vendors a bunch of stuff it barely uses and often doesn't really need, and is overall horribly architected.


I get you on unix philosophy (I'm not into it myself but I respect those who want that) but uv, for all its extra features, does actually do that particular "one thing" a lot better than pip.

You've summarised many of pip's internally problems well - there's also the lack of any attempt at proper manifest management. This is partially an ecosystem problem (pre-PEP518), but the tools inform the specs as much as the specs inform the tools.

I think there's also a reasonable argument to be made that uv only does one thing, & that the big problems in this space before was that python required using 3 tools to awkwardly collaborate to get one thing done. That one thing is dependency management: pip to pull them, venv to load them, pyenv to pull & load one of them (the interpreter).


pyenv is a wrapper for something that experienced pip+venv users would find trivial. If you use uv, meanwhile, that is also wrapping venv. It's integrating those tasks under one command prefix, which is the main thing I don't like.

The other thing I don't like is having tens of megs of opaque compiled binary (that doesn't provide a useful library) when properly designed Python would perform more than acceptably for common use cases (tons of this is I/O-bound; a proper cache lets you just recursively hardlink a directory tree instead of unpacking an archive file; the bytecode compilation is implemented in C and could be parallelized with `multiprocess` as long as you don't require binary-level reproducibility for Python bytecode; etc.)


Similarly - 80 line LISP interpreter with integers, lexical scope, first class functions

https://leontrolski.github.io/interpreter.html


Neat.

I'm trying to compress recipes into little schematics https://leontrolski.github.io/recipes.html


I like it. Reminds me a bit of the table format on Cooking for Engineers (scroll to the bottom of the recipe): https://www.cookingforengineers.com/recipe/19/Erics-Chocolat...


I was going to say the same! You can also check the recipe card here: https://www.cookingforengineers.com/recipe/19/Erics-Chocolat...



Ahh - the dependency graph recipe card. These are excellent. I've imagined something like this forever. Always annoyed that recipes put ingredients in a giant undifferentiated list and then give an instruction like "mix the dry ingredients in a deep bowl".

For a while I expected there could be a good return on a good implementation of this, but now as soon as a strong interface itself is created it seems easy to copy.


I used to want this kind of recipe card, but I've cooked so much that's no longer the case (I actually forgot all about the idea until reading this comment). I can usually look at the list of ingredients, and imagine what needs to be done. If it's an unusual or unfamiliar cuisine I will read the method, but after that point the list of ingredients suffice. If I read a recipe somewhere and want to cook it later, I will just write the ingredients on a post-it (usually in cooking order) and maybe 1-2 brief comments.

I imagine in domains you are skilled at you'd also prefer high level instructions than a step-by-step tutorial.

I agree that doesn't help the beginner, or someone who doesn't cook regularly, or someone cooking something new and I think most recipe writers are just following the established structure without thinking about what they and others really need.


”To bake an apple pie from scratch, first you must create the universe.”

— Carl Sagan


Feels like one might be able to get an llm to convert an annoying to read recipe into a mermaid dependency graph following this example. Might be worth a try!


Just tried https://www.mlynn.org/tools/generate-diagram and it didn't work.

FWIW though most recipes are basically ~10 steps long so a simple list suffice.

Still it could be an interesting experiment as I imagine that precisely recipes that are less sequential are (on average, with as challenging steps, e.g. excluding making caramel which has a high chance of burning) perceived as more complex.


I asked perplexity to convert a simple recipe to a dependency graph and it works pretty well! I like this graph to figure out my cooking workflow. What tasks can be started independently and what needs to be done before others.


That's a very cool site! I enjoyed the hand-drawn graphs.

Your tables remind me of recipes in Modernist Cuisine. They all have ingredients grouped by the procedures together with weight, sometimes volume, and ratio.

Example: https://modernistcuisine.com/wp-content/uploads/2013/01/Mac-...


I love this! I bet you could make a successful recipe book based on this concept, with large schematics that a cook can read from a distance while working in the kitchen.



This is like "Picture Cook: See, Make, Eat": https://www.amazon.com/Picture-Cook-Katie-Shelly/dp/16460416...


This is cool - I tried automating different recipe formats/visualizations at https://www.gobsmacked.io. I was thinking of trying to do something similar to this next.


I really like these. I went through a phase a couple years ago where I got really into cooking new fancy recipes, and having to scroll around on recipe pages, or try and read my own chicken scratch notes or understand the context I was trying to imply when I wrote the notes weeks ago was a struggle. Having everything more or less right there in front of your face seems really nice.

And I don't know why, but "Beans (green)" is really tickling my funny bone.


These are amazing. It feels so clear to see a visual ”map” of the cooking process before you even start.

This would help coordinate two cooks to make prepping more independent.

I’m trying to figure out if an landscape Ipad, with interactive elements for extra details if needed, would be a good UI for this.

-

Edit: Showed it to my non-Engineer wife and she said ”this is horrible” after staring at it for 10 seconds. Maybe not for everyone…


I write down recipes similar to this. I realised one day it's very similar to how a makefile works: https://blog.gpkb.org/posts/cooking-with-make/


This will perhaps be overkill for what you're trying to achieve, but there is Object Process Methodology (OPM)[1] which may be inspiration for modelling recipes. It looks similar to the methodology you're using, and as an example, expects the following type of modelling:

"peeling carrot" (process) consumes "washed carrot" (object)

"peeling carrot" (process) yields "peeled carrot" (object)

"peeling carrot" (process) yields "carrot peel" (object)

"finely dicing carrot" (process) consumes "peeled carrot" (object)

"finely dicing carrot" (process) yields "finely diced carrot" (object)

"prepare mirepoix" (process) consumes "finely diced carrot" (object)

"prepare mirepoix" (process) consumes "finely diced celery" (object)

"prepare mirepoix" (process) consumes "finely diced onion" (object)

"prepare mirepoix" (process) consumes "butter" (object)

"prepare mirepoix" (process) yields "mirepoix" (object)

The advantage of OPM is alignment of graphical and textual representations.

The downside of such approach is you soon discover how many millions of objects may exist in recipes--unwashed carrot, washed carrot, orange carrot, purple carrot, yellow carrot, white carrot, peeled carrot, coarsely diced carrot, finely diced carrot, julienned carrot... and purple julienned carrot vs. yellow julienned carrot. And that's just basic preparation complexity well before any contemplation of cooking or plating up elements. To go further you then discover a lack of useful labels such as "mirepoix" or "soffrito", if for example, you wanted to substitute sweet potato in place of carrot in the recipe.

Then there is SysML 2[2] which is kind of like OPM if you ever wanted to write a recipe in 35,000 lines of code, including possibly all the complexity of mathematical modelling of the Maillard reaction for purple carrots vs. yellow carrots using either extra virgin olive oil or butter. Probably best suited for the largest food processing companies such as Nestle, Unilever, Modelez, etc and even then, inherent complexity of their food products rarely would reach the level of a fine dining dish prepared by a chef.

[1] https://en.wikipedia.org/wiki/Object_Process_Methodology

[2] https://www.omg.org/spec/SysML/2.0/Language/PDF


OPM looks like a great way to implement a free-style crafting system for a roguelike. I mean instead of having standard recipes that you have to assemble you could invent your own by putting together basic ingredients but then you need a way to know what comes out (and its effects I guess). I don't know if any existing games do that.


Also have a look at Inform 7[1] (domain specific language for interactive fiction), specifically the "Stone" example section[2] which explains edible food and the effects different foods may have on the adventurer.

It's similar concept to OPM with some modelling basics already built on top for player movement throughout a world, player interaction with objects (looking at, lifting, moving), and many other primitives needed to write interactive fiction. And relevant to this thread, Inform 7 of course has modelling basics for a player eating food, drinking potions, etc.

[1] https://en.wikipedia.org/wiki/Inform#Inform_7_programming_la...

[2] https://ganelson.github.io/inform-website/book/RB_9_1.html


Thanks! I know Inform. Haven't used it but I know of it and I think I've even played a few games written with some version of it. Adventure games don't usually do what I had in mind but maybe it's possible to do just not something very relevant to the genre?


I mean Minecraft is quite similar in concept. Start with wood and stone and end up with an atomic bomb.

Also useful to watch Dr. Stone anime.


That's right. Hadn't thought of Minecraft, was thinking very narrowly about roguelikes. Text based and all.


Cute! I have a lot of handwritten notes. I've been waiting for a competent "paper scan to SVG" workflow to be developed so I can digitalize them properly. I think your project would also greatly benefit from something like that


Nice ideas, it just misses amounts. And of course there may be nuances of technique missing, e.g. low or high heat. So it might work best as a recap and starting point "how to vary m favourite recipe".


a lot of the schematics have avoidable edge crossings, that could improve intuitive readability enormously, theres entire subfields of graph theory that consideres rendering of graphs and planar embeddings.


Thank you for sharing!

This is inspiring. Cooking is this sort of an activity that is simple enough to not be overwhelming but also complex enough to be very interesting.

Both in practice and in modelling :-)


I'd prefer it if you minimized the crossing paths :-)


That is brilliant. Going to try some of yours then maybe transcribe my own favourites into the same format. You've struck on a great idea here.


That's really neat and easy to parse, love it!


This is how I write down recipes for myself! There’s got to be some cognitive archetype that works better with this style encoding.


Now this I love. It respects the craft of cooking and the human element, while giving instructions in an easy to grok and straightforward way.

Great job!


Nice! I do similar but yours are much more sophisticated. I list the ingredients and then group them at the side with instructions.


Great initiative ! So simple and yet it works (from those recipes listed I know, they are all working nicely).


My God what do you do to your feta?


Either crumble by hand or beat with an open end wrench.


I love it too, bookmarked and hopefully adopted! Did you write about it somewhere?


Dang this is the best way to represent a recipe I've ever seen. I love it


It's amazing how much more readable this format is. I love it.


The flowchart factorio of food preparation. Neat


This is really really awesome


Recipes-as-JSON?


What would be the equivalent to this in Haskell (with or without lens):

    cat = Cat(age=3)
    l = [1, [2, cat], 4]
    alt l[1][1].age.=9
That would give us l equal to:

    [1, [2, Cat(age=9)], 4]


In Haskell this list is not well-typed

    l = [1, [2, cat], 4]
There are a few different ways to cook this up. Here's one:

    {-# LANGUAGE TemplateHaskell #-}
    
    import Control.Lens
    
    data Cat = Cat { _age :: Int }
      deriving Show
    makeLenses ''Cat
    
    data Item
      = I Int
      | L [Item]
      | C Cat
      deriving Show
    
    makePrisms ''Item
    
    cat :: Cat
    cat = Cat 3
    
    l :: [Item]
    l = [I 1, L [I 2, C cat], I 4]
    
    l' :: [Item]
    l' = set (ix 1 . _L . ix 1 . _C . age) 9 l
    

    ghci> l'
    [I 1,L [I 2,C (Cat {_age = 9})],I 4]


This is surprising to me:

  l[1][1].age:9
  # (1,(2,{"age":9}),4)
How come it doesn't return just:

  {"age":9}
Or is there something totally different going on with references here? As in, how is this different to:

  l_inner = l[1][1]
  l_inner.age:9


Amending a slice would amend only the slice:

    l_inner:l[1][1]
    # {"age":3}
    l_inner.age:9
    # {"age":9}
    l_inner
    # {"age":9}
    l
    # (1,(2,{"age":3}),4)
If an amending expression isn't "rooted" in a variable binding, it also returns the entire new structure:

    (1,(list 2,list ().age:5),4)[1][1].age:99
    # (1,(2,{"age":99}),4)


Yes, AI or no AI, tell me about something actually interesting that you're working on.

Currently it feels a bit like everyone is talking about what new editor they're using. I don't care about that type of developer tooling very much. AI isn't coming up with some exciting new database, type system, etc etc.

"Look at how I'm able to web dev x% faster" because of LLMs is boring.


Ditto, another Upset blog post - https://leontrolski.github.io/upset.html


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: