Sept. 23, 2023 | Tags: math generative art fractals

In this post, I want to talk about L-Systems. These are a mathematical object that allows us to model complex recurring figures, almost fractal like structures, that can be defined very well mathematically. In the end, and what I used them for, was to draw beautiful figures.

[Read more]

Python Script Template

Sept. 16, 2023 | Tags: Python shell aliases

I often found myself writing the same basic script whenever I needed to start writing a small script for testing something or for writing a fully fledged program. And, of course, writing the same thing over and over again it gets tedious and boring. At some point, I figured it would be great to have a command that I can invoke and copy, from a template, this base.

[Read more]

Generate Django Secret Key

Aug. 10, 2023 | Tags: django TIL

Every now and again, I need to generate a Django secret key. And I always forget what is the function I have to call, and I end up looking it up every time.

[Read more]

Get current host's local IP

June 24, 2023 | Tags: python networking TIL

Sometimes, when working in a private network, it can be useful to know the current host IP address. If you are in the Linux shell, it can be as easy as using ifconfig and get it from there. However, if you need it in your application or in a script or in a programatic way, it's better to use the socket module from the standard library.

[Read more]

Debugging in python: ipdb, getting started.

June 21, 2023 | Tags: Python debugging

Python has a debugger shipped with the standard library: pdb. It allows you to stop the execution of your program and inspect the variables, methods and current state of your python program. However, while it works and does its job, I find myself often needing a bit more help than the debugger itself.

[Read more]

Neovim termguicolors + tmux default-terminal

June 8, 2023 | Tags: tmux TIL

Today, after a long while of having known the wrong configuration for the colours to look alright in and out of tmux along with neovim's termbuicolors feature, And I did not realise that the solution was right in from of me this whole time.

[Read more]

Django SQLite Backup

May 29, 2023 | Tags: Django python sqlite AWS

SQLite is a great database. It is embeddable, very portable and great for read-only applications. However, since it is stored in a single file, it can be hard to manage it in production environments with ephemeral file systems as you will need another process to back it up for you. Sometimes, you do not have access to the file system directly, see Heroku or Render, for example.

[Read more]

Django REST Envelope

April 9, 2023 | Tags: django django-rest-framework

In the list endpoints of a REST API, you usually send a list of objects. However, in the Django REST framework and, in particular, when using viewsets, the list method does return a list. But oftentimes it's very useful to return an object that has a key that contains that list. Why? Because you can send additional data, such as pagination, for example, without having to make breaking changes, among other things.

[Read more]
1 2