October of 2021
Activism⚑
Antifascism⚑
Antifascist Actions⚑
-
New: A fake company and five million recycled flyers.
A group of artists belonging to the Center for political beauty created a fake company Flyerservice Hahn and convinced more than 80 regional sections of the far right party AfD to hire them to deliver their electoral propaganda.
They gathered five million flyers, with a total weight of 72 tons. They justify that they wouldn't be able to lie to the people, so they did nothing in the broader sense of the word. They declared that they are the "world wide leader in the non-delivery of nazi propaganda". At the start of the electoral campaign, they went to the AfD stands, and they let their members to give them flyers the throw them to the closest bin. "It's something that any citizen can freely do, we have only industrialized the process".
They've done a crowdfunding to fund the legal process that may result.
Feminism⚑
Privileges⚑
-
New: Feminist analysis of privileges and rights.
Privileges are a group of special structural benefits, social advantages, that a group holds over another. So they are elements that should be removed from our lives.
Some of the topics included are:
- What's the difference between privilege and right
- What can we do to fight the privileges?
Life Management⚑
Book Management⚑
-
New: Introduce the book management concept.
Book management is the set of systems and processes to get and categorize books so it's easy to browse and discover new content. It involves the next actions:
- Automatically index and download metadata of new books.
- Notify the user when a new book is added.
- Monitor the books of an author, and get them once they are released.
- Send books to the e-reader.
- A nice interface to browse the existent library, with the possibility of filtering by author, genre, years, tags or series.
- An interface to preview or read the items.
- An interface to rate and review library items.
- An interface to discover new content based on the ratings and item metadata.
I haven't yet found a single piece of software that fulfills all these needs, in the article I tell you about Readarr, Calibre-web, [calibre]((https://manual.calibre-ebook.com/), Polar bookself, GCStar, and how they interact with each other.
-
Improvement: Add link to the calibre-web kobo integration project.
Coding⚑
Python⚑
Full screen applications⚑
- New: Testing full screen applications.
-
To map an action to two key presses use
kb.add('g', 'g')
. -
New: Add note on how to debug the styles of the components.
Set the style to
bg:#dc322f
and it will be highlighted in red.
Click⚑
-
New: Invoke other commands from a command.
This is a pattern that is generally discouraged with Click, but possible nonetheless. For this, you can use the
Context.invoke()
orContext.forward()
methods.
Optimization⚑
-
New: Add tips on how to optimize your python command line tools.
-
Minimize the relative import statements on command line tools:
When developing a library, it's common to expose the main objects into the package
__init__.py
under the variable__all__
. The problem with command line programs is that each time you run the command it will load those objects, which can mean an increase of 0.5s or even a second for each command, which is unacceptable. * Don't dynamically install the package:If you install the package with
pip install -e .
you will see an increase on the load time of ~0.2s. It is useful to develop the package, but when you use it, do so from a virtualenv that installs it directly without the-e
flag.
-
Flask Restplus⚑
-
New: Introduce the Flask-RESTPlus library.
Flask-RESTPlus is an extension for Flask that adds support for quickly building REST APIs, but I'd use FastAPI instead.
Pytest⚑
-
New: Exclude the
if TYPE_CHECKING
code from the coverage.If you want other code to be excluded, for example the statements inside the
if TYPE_CHECKING:
add to yourpyproject.toml
:[tool.coverage.report] exclude_lines = [ # Have to re-enable the standard pragma 'pragma: no cover', # Type checking can not be tested 'if TYPE_CHECKING:', ]
Python Snippets⚑
-
New: Check if a dictionary is a subset of another.
If you have two dictionaries
big = {'a': 1, 'b': 2, 'c':3}
andsmall = {'c': 3, 'a': 1}
, and want to check whethersmall
is a subset ofbig
, use the next snippet:>>> small.items() <= big.items() True
-
Correction: Group or sort a list of dictionaries or objects by a specific key.
Improve previous method with the concepts learned from the official docs
Particularly improve the sorting by multiple keys with the next function:
>>> def multisort(xs, specs): for key, reverse in reversed(specs): xs.sort(key=attrgetter(key), reverse=reverse) return xs >>> multisort(list(student_objects), (('grade', True), ('age', False))) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
-
Correction: Install default directories and files for a command line program.
I've been trying for a long time to configure
setup.py
to run the required steps to configure the required directories and files when doingpip install
without success.Finally, I decided that the program itself should create the data once the
FileNotFoundError
exception is found. That way, you don't penalize the load time because if the file or directory exists, that code is not run. -
a = ['a', 'b'] index = a.index('b')
-
New: Transpose a list of lists.
>>> l=[[1,2,3],[4,5,6],[7,8,9]] >>> [list(i) for i in zip(*l)] ... [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
-
New: Check the type of a list of strings.
def _is_list_of_lists(data: Any) -> bool: """Check if data is a list of strings.""" if data and isinstance(data, list): return all(isinstance(elem, list) for elem in data) else: return False
Prompt Toolkit⚑
-
New: Basic concepts of building full screen applications with python prompt toolkit.
prompt_toolkit
can be used to create complex full screen terminal applications. Typically, an application consists of a layout (to describe the graphical part) and a set of key bindings.In the section we cover:
- The layout
- The controls
- How to use key bindings
- How to apply styles
- A difficult ordered list of examples to get a grasp of these concepts with simple working code.
Pydantic⚑
-
New: Copy produces copy that modifies the original.
When copying a model, changing the value of an attribute on the copy updates the value of the attribute on the original. This only happens if
deep != True
. To fix it use:model.copy(deep=True)
.
Promql⚑
DevOps⚑
Infrastructure as Code⚑
Helmfile⚑
-
Correction: Use environment name instead of get values.
Instead of
.Environment.Name
, in theory you could have used.Vars | get "environment"
, which could have prevented the variables and secrets of the default environment will need to be calleddefault_values.yaml
, anddefault_secrets.yaml
, which is misleading. But you can't use.Values
in thehelmfile.yaml
as it's not loaded when the file is parsed, and you get an error. A solution would be to layer the helmfile state files but I wasn't able to make it work. -
New: How to install a chart only in one environment.
environments: default: production: --- releases: - name: newrelic-agent installed: {{ eq .Environment.Name "production" | toYaml }} # snip
-
New: Add note that templates can't be used inside the secrets.
See this issue
Terraform⚑
-
New: How to do elif conditionals in terraform.
locals { test = "${ condition ? value : (elif-condition ? elif-value : else-value)}" }
-
New: How to enable debug traces.
You can set the
TF_LOG
environmental variable to one of the log levelsTRACE
,DEBUG
,INFO
,WARN
orERROR
to change the verbosity of the logs.
Helm Secrets⚑
-
Correction: Update the repository url.
The last fork is dead, long live the fork
-
New: How to install the plugin.
Continuous Integration⚑
Flakehell⚑
-
New: Troubleshoot the 'Namespace' object has no attribute 'extended_default_ignore' error.
Add to your
pyproject.toml
:[tool.flakeheaven] extended_default_ignore=[]
-
New: Latest version is broken.
It returns an ImportError: cannot import name 'MergedConfigParser' from 'flake8.options.config', wait for the issue to be solved before upgrading.
Dependency managers⚑
-
New: Sync the virtualenv libraries with the requirements files.
python -m piptools sync requirements.txt requirements-dev.txt
-
Correction: Use
-c
instead of-r
in the nested requirement files.To avoid duplication of version pins.
Operative Systems⚑
Linux⚑
Dynamic DNS⚑
-
New: Introduce the Dynamic DNS concept.
Dynamic DNS (DDNS) is a method of automatically updating a name server in the Domain Name Server (DNS), often in real time, with the active DDNS configuration of its configured hostnames, addresses or other information.
Hard drive health⚑
-
New: Taking care of your hard drives.
Hard drives die, so we must be ready for that to happen. There are several solutions, such as using RAID to minimize the impact of a disk loss, but even then, we should monitor the bad sectors to see when are our disks dying.
In the article we talk about S.M.A.R.T and how to solve some hard drive problems.
Kitty⚑
-
New: Introduce kitty the terminal emulator.
kitty is a fast, feature-rich, GPU based terminal emulator written in C and Python with nice features for the keyboard driven humans like me.
-
New: Scrollback when ssh into a machine doesn't work.
This happens because the kitty terminfo files are not available on the server. You can ssh in using the following command which will automatically copy the terminfo files to the server:
kitty +kitten ssh myserver
-
New: Enable infinite scrollback history.
To make the history scrollback infinite add the next lines:
scrollback_lines -1 scrollback_pager_history_size 0
-
New: Reasons to migrate from urxvt to kitty.
- It doesn't fuck up your terminal colors.
- You can use peek to record your screen.
- Easier to extend.
Peek⚑
- Correction: Add note that it works with kitty.
Arts⚑
Drawing⚑
-
Ellipses are the next basic shape we're going to study (after the lines). They are extremely important and notoriously annoying to draw. Important because we're going to be using ellipses in 2D space to represent circles that exist in 3D space.
In this section we:
- Introduce the basic concepts surrounding the ellipses
- How to draw them.
Exercise Pool⚑
-
New: Add the Tables of ellipses drawing exercise.
This exercise is meant to get you used to drawing ellipses, in a variety of sizes, orientations and degrees. It also sets out a clear space each ellipse is meant to occupy, giving us a means to assess whether or not an ellipse was successful, or if there were visible mistakes (where it went outside of its allotted space, or ended up falling short). Practicing against set criteria, with a way to judge success/failure is an important element of learning. There's nothing wrong with failure - it's an opportunity to learn. Having a clearly defined task allows us to analyze those failures and make the most of them.