/images/p1.jpg

Hi, I'm Tomasz

I'm a professional C++ software engineer with over a decade of hands on development experience with variety of technologies (mostly Linux & embedded systems). This is my blog.

Find me on social media

Shell quick tips: Bash incognito mode

Shell history is essential but sometimes undesired and has to be disabled. This is often the case when working with API keys, passwords or any type of credentials. I often find myself using API keys like that when working on a new script or doing some simple API tests with curl.

Bash, allows disabling history using:

set +o history

but this is not very convenient as the history is disabled in the running session as well so, jumping back is no longer possible.

golang's defer in C (kind of)

Quite often I find myself landing on gcc’s attributes documentation page. Not sure how that happens but this is always a gold mine. I’ve recently discovered __attribute__((cleanup(func))), which allows attaching functions to variables. These functions are executed when the variable goes out of scope. Sounds familiar?

Nix is to C++ what uv/poetry is to Python

The topic of dependencies management is coming back and again. nix and nixpkgs being a rich repository, provides a convenient way to manage both project dependencies and related tooling in a reproducible way. This is something I’m finding more and more useful as a fundamental development tool. nix is quite complex and some exploration is needed to wrap your head around it. In this post, I’m going through most basic use cases as well as describe some basics of nix language itself - mainly for my own reference but hopefully useful to others as well.