Worked on performance, so I can add more grass (or in future more objects).

Here is the writeup of changes: .

I'll work on something else than grass next :)

I have also somewhat widened (and randomized) the base of the blade of grass. I might revert that change though.

Show thread

Me: Dear I'd like a dict that is immutable, as immutable objects are nice and safe to use;
Python: Why don't you use types.MappingProxyType?
Me: It's not Pickleable[1];
Python: Wait some time and use ``frozenmap``;
Me: It does not support O(1) operations[2];
Python: Why don't you roll your own?
Me: 🤦‍♀️

I'll download some implementation from PIP, don't worry. But I'm mildly irritated that I need.


Good thing: it looks **better**, also I have improved performance (by doing the dumbest thing: using multiprocessing).

Bad thing is: povray files exploded from ~10mb to ~80mb.

Key was to use "ambient"[1] property for "grass". Previously grass was darker that it should be as it was illuminated from the random direction. Now ambient lightning means that they are magically always illuminated.

Show thread

Another entry about landscape generator.

Reworked some code, to allow me to easily randomize colors, without ugly hacks I used last time.

Choose another (still randomly/computer generated palette).

Results are better but still suck :/

Will need to read into color theory (maybe just globally allow much less dark colors?).

Or maybe the "grass" is just bad. Need to think.

Also python is starting to be the bottleneck :/ (generating 100k of objects and printing them to a file).

Show thread

Finally managed to add some grass!

Colors are not yet randomized, will work on this next.

Show thread

Another weird debug geometry, it's somewhat soothing (the yellow balls not the spikes) so I'll leave yellow balls somewhere.

Show thread

Still trying to figure out how to add foliage.

In the meantime I have added sun.

Problem is that if sun is visible currently is rather boring as it lacks shadows.

Also I could probably add some texture to the "height field" (i.e. ground).

Show thread

and fun continues.

1. First image is randomly generated height-map.
2. Second is rendered landscape, featuring debug markers (namely red ball and yellow translucent cylinder)

The above was generated by python script executing povray thingy.

Show thread

fun continues:

It's the same as previously but:

1. Povray file is generated from script, that works on python objects;
2. Heightfield is not created in Gimp but generated from array.
3. I saved 10 seconds of my life by generating spheres using for loop.

The end goal is to re-create something that renders landscapes similar to: @wildflowersbot

I've been using python for 5+ years, and I didn't know of ``turtle`` [1] module.

It's a standard library module that works simirarily like logo programming language.


is **so good** for teaching. (And is second best language for every other use).


class SlightlyUpdatedPasswordChangeView(PasswordChangeView): pass


R0901: Too many ancestors (10/7) (too-many-ancestors)


This just how we do stuff here.


Is there any "easy"/"magic" way to do Postgresql Upsert in , without writing pure SQL code? (By upsert I mean "INSERT ON CONFLICT").

Is thee anything that allows me to say: "dear get me all packages and their dependency tree for my project and download them locally" and then install all packages from that cache on a system without the Internet access.

Did you know that python `calendar.Calendar` can start weekend on e.g. Tuesday?

I needed to work with weekends defined as: "From 6 AM Saturday to 6AM Monday". Starting weeks an Tuesday was super useful.

If you never knew about __debug__ variable, or '-O' interpreter option, here is helpful post that explains what it is, how to use it, and why I needed that in a project I did:

I don't usually use Azure, but recently on some project I wanted to use Azure storage. So I added 'django-storages[azure]'. Here is what ended up in my (pinned down) requirements list.

If you ever wondered how to display all actions taken by the administrator on a django admin site, here is how: .

It's also possible that I found a some kind of bug in django runserver command.

I was doing frontend stuff that did a lot of fetch API requests to django backend (in developement mode) running on runserver. Due to unrelated bug server wasn't consuming response body.

And every other request was returning 400 request with error: code 400, message Bad request syntax ('{"name":"thing"}PATCH /endpoint/path HTTP/1.1).

When I switched to gunicorn everything started working.

New blog post on my ugly-on-purpose blog: .

This time: why mmap system call is magic!

Show older
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!