Dawid Ciężarkiewicz aka `dpc`

My name is Dawid Ciężarkiewicz. Among many things, I'm a long time Open Source user and contributor, a software engineer by profession and passion.

Helix file picker with lf

In $HOME/dot/.config/helix/config.toml [keys.normal] C-f = [":new", ":insert-output lf -selection-path=/dev/stdout", "split_selection_on_newline", "goto_file", "goto_last_modification", "goto_last_modified_file", ":…

2024-02-16 · 1 min · 

Cool Fish Shell abbreviations

Inside $HOME/.config/fish/config.fish: function multicd echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../) end abbr --add dotdot --regex '^\.\.+$' --function multicd function last_history_item; echo $history[1]; end abbr -a !! --position anywhere …

2024-02-12 · 1 min · 

Remap Caps Lock to Esc and some

Using xremap > cat .config/xremap/config.yml modmap: - name: CapsLock to RightCtrl/Esc remap: CapsLock: held: Ctrl_R alone: Esc alone_timeout: 500 keymap: - name: RightCtrl+hjkl to Arrows remap: Ctrl_R-h: Left Ctrl_R-l: Ri…

2024-02-12 · 1 min · 

Pretty selection sort in Rust

use itertools::Itertools; fn selection_sort(mut v: &mut [u8]) { while let Some(smallest) = v.iter().position_min() { v.swap(0, smallest); v = &mut v[1..]; } } Rust Playground link

2023-12-06 · 1 min · 

You can't just avoid complexity

Recently I've seen lots of articles about avoiding complexity in software. The general trend is always: "Simple good, complex bad", "Avoid complexity", "Build small", etc. Here is the thing: truly simple software usually sucks. That's why almost noth…

2023-12-06 · 2 min · 

Nix users, you can fearlessly start using Rust scripts already

cargo-script is an in-progress feature of cargo, that allows writing "shell-like" scripts using Rust and run them as such. It's already implemented and available in the Rust nightly toolchain. For time being, this makes it a bit inconvenient to use as it requires sourci…

2023-11-15 · 2 min · 

Did some CLI/terminal self-care over the weekend

Did some CLI/terminal self-care over the weekend. Started with trying out Monaspace. Led to Wezterm, led to polishing and integrating everything into a coherent whole. I have now this nested 3-level hierarchy (terminal tabs, tmux tabs, helix tabs), which acts are workspace and w…

2023-11-14 · 1 min · 

Embedding git version hash in a binary in a Nix friendly way

In Fedimint we have developed a quite neat way to embedded verision hashes in all the binaries. It works both for builds in a local dev shell and in the build artifacts produced as Nix flake outputs. It does not unnecessarily invalidate the Nix derivations. I'm not saying it's p…

2023-11-14 · 2 min · 

Migrating my blog from write.as

I've been using https://write.as to host my blog for years, but unfortunately they've never added a proper solution to achieving proper "archives" page. As the number of my posts increased, this became increasingly annoying. I finally decided to migrate things to self-h…

2023-09-26 · 1 min · 

git alias to make a single commit reverting to previous commit

If you ever need to make a PR that just reverts the state of a branch to a certain point, you might find this useful:

2022-06-30 · 1 min · 

Be careful what you measure because you will optimize it

Humans are very competitive. If you give them a number to rate themselves with, they will try to increase it. If you find an Open Source project, and it's not very optimized on a certain metric you care about, to make it better, you have to do only one thing: write a benchmark fo…

2022-06-05 · 7 min · 

On always using the "lower than" operator

A couple of years ago I've read a blog post somewhere, where the author said that they always use < or <= and never > and >=. So instead of: if v.len() > MAX_ALLOWED_SIZE { which is written the way one would say it: "if the length of v is greater than allow…

2022-06-04 · 2 min · 

Public toilet model of maintaining a codebase

I find that it's useful to think about software projects as restrooms. Surprisingly a lot of aspects of software development fit well in this analogy. We have toilets (codebases) to serve our needs. We don't particularly value them for what they are, other than as much as they ar…

2022-06-03 · 3 min · 

Software project estimation is like drawing a spiderman

Please check this out first (feel free to skip around): Have you noticed, that drawing a spiderman is very much like building a software project? No? Here's why I think so: You are an SWE and let's say you have a manager or PM asking you: "How long will it take you to draw…

2022-06-03 · 2 min · 

My case against mocking frameworks

Since "mocks" and "mocking" is somewhat vague, and nuances between mocks, fakes, mock objects, test doubles, spies, etc. are confusing, let's start with what I mean by "mocking". What I mean by it is intercepting and/or substituting internal and ofte…

2022-04-23 · 5 min · 

"Objects" (in OOP) are just confusing people

I have recently discovered a very good youtube channel about business software development: CodeOpinion. Very concisely yet informative. I highly recommend it. Don't worry - it's OOP-rant free, and all about mainstream accepted good practices, not some wacko OOP-hater like me. An…

2022-02-15 · 3 min · 

What I'd like you to know about making your software fast

I like fast code, and I cannot lie. I've been optimizing a lot of projects over the years, and here are some tips that I'd like to share with you Remember to optimize the whole system, and not individual parts# This one is a big one and it's counter-intuitive so it goes first: …

2022-01-23 · 19 min · 

Adding parallelism to your Rust iterators with `dpc-pariter`

TL;DR: I published a parallel processing library for Rust that works differently than rayon and is especially useful in cases where rayon falls a bit short. I'll talk a little bit about it, and show you when it can be helpful. rayon is a well known and regarded library for Rust:…

2022-01-08 · 4 min · 

"Data-Oriented Programming Unlearning objects" - short review

I've recently purchased the Data-Oriented Programming Unlearning objects by Yehonathan Sharvit. I and would like to write out some notes I've captured during reading it. I don't like technical/programming writing using personal narration. It just seems fluffy to me. A lot of wo…

2021-12-29 · 4 min · 

Making Open Source economy more viable with dual license collectives

I've been a FOSS enthusiast since around 1998 when I discovered Linux when I was about 13 years old. It was truly one of the definitive events in my life. There is something extraordinary and even spiritual in the idea of a global, voluntary, collaborative yet competitive network…

2021-12-07 · 5 min ·