When preparing build configuration in sbt, you might want to write custom sbt task. Task in sbt is like a function that can depend on other tasks and project settings. 
 Custom sbt tasks 
 To illustrate it, let’s write a simple task that validates environment, runs tests and builds an app 
 
 
 
 
 
 scala 
 
 
 
 
 import sbt. * 
…
On January 30, 2025, the first Scala Tooling Spree took place, and I had the pleasure of being part of it. Here’s a recap of the event. Spoiler alert: it was awesome! 
 Event details 
 The first Scala Tooling Spree was announced on Discord and Bluesky .
The event brought together 9 participants who formed 4 teams. Over the course of a 2-hour call, we tackled 4 issues, resulting in 3…
TL;DR : Today I learned that you can trace your build performance with bloop , and it’s especially easy when using Metals. The setup might not be obvious for some. 
 When working with multi-module projects, build times can sometimes increase unexpectedly. There are a few ways to analyze that statically, but you can always see the live data from your bloop compilation. Let’s explore…
In this post we’ll learn how to build and deploy your own feed on Bluesky. We’ll start with some background info on Bluesky and how feeds work. Then we’ll code and deploy our own feed. Don’t worry about the complexity, it’s mostly filling the gaps in the template. 
 What’s Bluesky 
 Bluesky is a decentralized social network. From the end user…
TL;DR Today I learned a few useful commands to help you understand complex sbt builds. 
 task timing 
 JAVA_OPTS=-Dsbt.task.timings=true sbt 
 inspecting task 
 inspect module/taskName 
 inspecting task tree 
 inspect tree module/taskName
TL;DR Today I learned that you can hide irrelevant changes from Github PRs . The syntax for .gitattributes can be tricky though. 
 In my current project, it’s sometimes necessary to re-generate and commit a bunch of files to the repository. This can happen when you store some IaC or test data in the repository. 
 Sample repository 
 To demonstrate the problem, here’s an…
When creating software that makes heavy use of cloud infrastructure, it is wise to test the integration in the end-to-end fashion. Doing so in cloud environment is one option, but it may not be viable for all cases. It can be pricy and you cannot do it in an local environment. 
 A popular solution to this problem is to run Localstack and test your code against it. In this post we’ll…
This article is a follow up to Type safety with refined , make sure to check it out if you haven’t. 
 In this one we’ll repeat the same thing but this time using iron . 
 Unsafe approach 
 Similarly to the previous post, we’ll try to refactor the code below to eliminate the handwritten value checks. The goal is to express our business requirements using the…
Throughout this blog I’ve mentioned the benefits of having a strong type system a multiple times. I’ve covered type refinement for value validation , beginner friendly and advanced approach to type-class derivation or type-safe approach to messaging with pass4s . 
 The possibilities are endless though, so today I want to introduce another topic, that beginners in languages like…
In the previous post about Scala derivation I’ve explained the idea of derivation and showed how we can benefit from it by using library-provided derivations. This time let’s dig deeper and implement our own derviation with Magnolia . 
 
 TL;DR This post is intended for intermediate Scala users, if you are not familiar with the topic I recommend starting with the beginner…
When learning about Scala, there are a few things that might be surprising. One of such mechanisms is code derivation. With this post I want to demystify the term for those of you who are learning Scala and functional programming in general. 
 
 TL;DR This post is intended for Scala beginners and does not go into the details of building your own derivation. Instead, it shows the client…
Last Thursday (13.04.2023) I had the pleasure to speak at the 5th edition of Tech Bytes in Kraków. 
 TL;DR This post is a short recap of the event 
 🔧 The right tools for the right job 
 This edition had two talks scheduled, both focused on programming languages, specifically Scala and Elixir. “The right tools for the right job” was the topic of the meeting. 
 The…
So you are learning Scala and see all the news about scala-cli and it becoming the new scala runner , Scala Toolkit , Typelevel Toolkit and things become a little confusing? 
 This post is here to help you understand what’s going on. To make some sense of it, let’s tell a bit of a story. 
 💻 Scala runner and scala-cli 
 First of all, what’s Scala runner? basically…
In the previous post we have learned how pass JSON and XML messages via the SNS/SQS using pass4s . This time we’ll focus on another problem, often faced when implementing messaging in backend systems. We’ll learn how to handle large messages. 
 As with previous posts, you’ll find all code examples in the companion repository https://github.com/majk-p/pass4s-playground . Along…
In the previous post we have learned how implement the SNS/SQS based message flow using pass4s . The examples only shown how to exchange basic string messages. In this one I’ll show you how to exchange more complex types and serialize them in transport. Examples shown in this post are also available in https://github.com/majk-p/pass4s-playground/ so feel free to clone and play around. 
…
The pass4s provides a functional abstraction for messaging in Scala. It provides implementations for AWS SQS/SNS and ActiveMQ. 
 In this post I want to show you the basic usage of the library to implement the messaging on top of SNS/SQS. All the examples in this post can be found in https://github.com/majk-p/pass4s-playground . 
 Localstack 
 Before we see the Scala code, let’s…
TL;DR I wanted to launch a flashlight on Android device using Typescript and the experience was far from ideal . 
 The task 
 Background: there’s a web application that runs a camera to scan for QR codes. Sometimes the light conditions are poor and scanning is difficult. 
 The task: Launch the flashlight to improve the scanning experience. 
 Doesn’t sound that…
In the previous post in the series I described the process of externalizing you HA (Home Assistant) using my custom addon. Make sure to check that out if you haven’t already. This time I’ll share the details of the add-on development process. 
 First steps 
 When building the add-on my first steps obviously went towards the existing online resources. The first thing I’ve…
In this post I want to share a short recap of first Wrocław Scala User Group (WSUG) meetup. This will be kind of TIL entry, it doesn’t aim to cover the full presentation content. If you’d like to join the next meeting, join us at Wroclaw Scala User Group at meetup.com . The meetup was held in Polish so the slides are not translated. 
 First talk - ‘Pain-free APIs with Smithy4s’ -…
This is a third post in the Smart Home series. See the previous post if you haven’t already: https://blog.michal.pawlik.dev/posts/smarthome/zigbee-setup/ . Last time I wrote about Zigbee and shown how to control smart home devices. In this post I want to show you one of many ways you can use to expose your HA (Home Assistant) instance to the internet. 
 Why expose? 
 All of the…
In this post I want to share a short recap of first Wrocław Scala Java Group (WSUG) meetup. This will be kind of TIL entry, it doesn’t aim to cover the full presentation content. You can find the full agenda at the event page . If you’d like to join the next meeting, join us at Wroclaw Java User Group at meetup.com . 
 We just had one talk this time, and it was delivered by yours…
This is a second post in the Smart Home series. See the previous post if you haven’t already: https://blog.michal.pawlik.dev/posts/smarthome/smart-home-getting-started/ . Last time we have set up the HA (Home Assistant), in this post we’ll learn about Zigbee and control some devices. 
 Zigbee 
 Zigbee is a specification for wireless communication protocols, very common solution…
TL;DR Today I learned how to fix post visibility by reading the documentation https://gohugo.io/getting-started/usage/#draft-future-and-expired-content 
 Last night I’ve been finishing my first blog post this year. Upon finishing the text and finding the icon it’s time to fill the metadata. Midnight was minutes away so I set the publish date to 2023-01-04 (next day) and set the…
New year is always a good excuse to start something new. This post starts a series on building a smart home. It’s not going to be a tutorial written by an expert, quite the opposite, I want to share my thoughts and experiences while learning. 
 At this point I want to give credit to Kinga and Mikołaj - friends of my who inspired me with their smart home setup and guidance through first…
Note on automation 
 A while back when I was working as an SRE . I’ve learned this one approach that has proven useful multiple times. Whenever I prototype something, even if it’s as simple as one liner in bash, I put it into the file, making it a script. In the process I’d usually prepare a few of the, trying my best to name them meaningfully, put up a concise readme and…
Do you know that feeling, waking up in the morning just to learn your website and self hosted services are down for unknown reason? That moment when you feel your VPS has literally moved to the cloud? 
 The fire 
 This is exactly what happened to me one day of March in 2021. I woke up in the morning, checked the news and learned that there’s an fire incident in SBG2 (sources:…
Say you want to start a blog, perhaps even join #100DaysToOffload . There are some questions you need to ask yourself. How do I start? Do I create an account somewhere? Should I build a website? 
 For the starters, you have two options. You can either go for using a platform or for self hosted. 
 Blogging platforms 
 Say you want someone to host the platform for you, then you have some…
In this post I want to share a simple solution for the simple problem I wanted to solve some time ago. The problem definition is following: 
 I have a top level domain and a VPS operating on it. I also have a blog you are reading now hosted with Gitlab Pages . I want to host a website from my top level domain. 
 Hosting pages using Gitlab pages (similarly to Github Pages ) is very…
Lately I’ve been working on preparing learning materials in Scala. Usually when I work on preparing slides for public speaking I would use https://slides.com/majkp/ , but this time I was looking for something self hosted. 
 In this situation Reveal.js seems like an obvious alternative, but if you want to set up, you either have to download a fixed version which makes the upgrade hard, or…
In this short entry I want to shed some light at the difference between <: and <:< in Scala. 
 TL;DR 
 
 <: is a language feature built into the compiler: upper type bound 
 <:< is it’s generalization: generalized type constraints - it’s provided in the standard library 
 
 Let’s start with the first one. <: is called the upper type bound .
We use it…
This is a list of articles I wrote during my #100DaysToOffload : 
 
 https://blog.michal.pawlik.dev/posts/100-days-to-offload/ 
 https://blog.michal.pawlik.dev/posts/wsug-001/ 
 https://blog.michal.pawlik.dev/posts/recruitment-homeworks-considered-harmful/ 
 https://blog.michal.pawlik.dev/posts/til/value-class-typescript/ 
…
Job interview is not an easy thing, neither for the candidate, nor the recruiters. From the candidate’s perspective it’s stressful to be questioned, the recruiters need to make a good judgement. Interview process is a thing that’s easy to make wrong and expensive to make right. Recruitment mistakes are difficult to fix, when you hire someone and you haven’t tested them well…
TL;DR Today I learned how to mimic Scala-like value class in Typescript 
 Doing day to day scala I often use value classes to model the data like: 
 
 
 
 
 
 scala 
 
 
 
 
 final case class UserId ( value : String ) extends AnyVal 
 final case class City ( value : String ) extends AnyVal 
 
 This is especially useful when you want to…
In this post I want to share a short recap of first Wrocław Scala User Group (WSUG) meetup. This will be kind of TIL entry, it doesn’t aim to cover the full presentation content. You can find the full agenda at the event page . If you’d like to join the next meeting, join us at Wroclaw Scala User Group at meetup.com . 
 This is my second post in #100DaysToOffload . 
 First talk…
Today I’m joining the 100 Days To Offload challenge. Starting from today I aim to publish 100 blog posts by 12.12.2023. 
 The idea is described in more detail at the project page https://100daystooffload.com/ . Quoting the page: 
 
 Posts don’t need to be long-form, deep, meaningful, or even that well written. If there are spelling and grammar mistakes, or even if there’s no real…
In this article I want to share my experience from Global Day of Code Retreat 2022. 
 The initiative 
 GDCR is an annual event organized on site and virtually all over the world. As the event page describes it: 
 
 Coderetreats are free day-long, intensive practice events, focusing on the fundamentals of software development and design. By providing developers the opportunity to…
Goal 
 In this article we’ll learn how to use the Scala type system for avoiding runtime errors. On our way we’ll learn some basics about scala-cli . 
 Bootstrap 
 In this article we’ll rely on simple examples, thus instead of sbt we’ll use scala-cli , a lightweight command-line utility to work with Scala. 
 First we’ll need to install the utility. For…
Building simple Scala web application with OAuth2 Github login - part 2 
 In the first part we have prepared a simple web application using Scala with Tapir and Http4s. It can be found in this commit . In this part we’ll integrate our application with Github, providing OAuth2 login and some basic API integration. 
 Before we get started make sure to register a Github application.…
Building simple Scala web application with OAuth2 Github login - part 1 
 Welcome to the first article in the series. In following posts we’re going to build a web application using Scala. 
 Goal 
 In this series we’ll learn how to: 
 
 Start project from scratch 
 Create web service 
 Implement user login using OAuth2 authorization code grant 
 Interact…
It’s been around 5 years since last post. A lot has changed since then, and it’s a good time for a reboot. From now on my posts will be written in english, potentially making them useful for a wider audience. 
 All of my old posts are still available via direct links, but are no longer listed as most of them are already quite outdated. The only exception is Hacker howto , as…
Niniejszy dokument jest tłumaczeniem oryginału dostępnego na http://www.catb.org/esr/faqs/hacker-howto.html w wersji 1.50. Autorem oryginału jest Eric S. Raymond . Motywacją, dla której chcę podzielić się tłumaczeniem jest ogromna wartość edukacyjna dokumentu. W mojej opinii stanowi on zbiór bardzo cennych oraz inspirujących rad dla początkujących i rozwijających się programistów. Przed…
OpenCV ( Open Source Computer Vision ) jest otwartą, wieloplaformową biblioteką służącą do analizy obrazu w czasie rzeczywistym. Napisana w języku C posiada jednak nakładki pozwalające na jej wykorzystanie między innymi w językach C++, C# czy Python. Jak zwykle, zapoznanie z tą biblioteką przeprowadzimy w ostatnim z wymienionych języków. 
 W tym artykule chcę przedstawić kilka podstawowych…
Analiza kodu webaplikacji zdecydowanie różni się od reverse engineeringu jaki znamy z analizy aplikacji desktopowych czy mobilnych. W przypadku webaplikacji nie mamy kodu backendu, więc musimy kierować się przesłankami na jego temat, które wynikają z danych wynikowych. Jedyny kod do analizy jaki otrzymujemy to JavaScript załączony do strony. 
 Na wstępie tego wpisu chcę zaznaczyć, że analizą…
Wpis jest kontynuacją rozwiązań hackme Natas na OverTheWire. Rozwiązania etapu 17 można znaleźć tutaj . Etapy 18 i 19 związane będzą z pojęciem sesji, a zatem również ciasteczek. Przed przystąpieniem do rozwiązania upewnij się, że posiadasz rozszerzenie pozwalające na modyfikacje ciastek w swojej przeglądarce. 
 Poziom 18 
 Analiza 
 Po zalogowaniu na poziom 18 spoglądamy na kod…
Wpis jest kontynuacją rozwiązań hackme Natas na OverTheWire. Rozwiązania etapu 16 można znaleźć tutaj . Etap 17 to kolejne zadanie związane z atakami SQLi, jest on rozwinięciem zadania numer 15 . Polecam zapoznanie się z jego rozwiązaniem, gdyż będziemy nawiązywać do metody przedstawionej w poświęconym mu wpisie. 
 Analiza 
 Po zalogowaniu na poziom 17 spoglądamy na kod źródłowy: 
…
Wpis jest kontynuacją rozwiązań hackme Natas na OverTheWire. Rozwiązania etapu 15 można znaleźć tutaj . Etap 16 powiązany jest bezpośrednio z etapem numer 9, którego rozwiązanie możemy przypomnieć sobie w tym poście . 
 Analiza 
 Po zalogowaniu na poziom 16 spoglądamy na kod źródłowy: 
 <?
$key = "";

if (array_key_exists("needle", $_REQUEST)) {
…
Wpis jest kontynuacją rozwiązań hackme Natas na OverTheWire. Rozwiązania etapu 14 można znaleźć tutaj . 
 Analiza 
 Używając hasła uzyskanego na poprzednim poziomie 15 logujemy się na poziom 16. Otrzymujemy formularz, który pozwala sprawdzić czy w bazie znajduje się użytkownik o zadanym loginie. Jest to kolejne zadanie, w którym wykorzystamy podatność typu SQL Injection , jednak tym razem…
Wpis jest kontynuacją rozwiązań hackme Natas na OverTheWire. Rozwiązania etapu 13 można znaleźć tutaj . 
 Analiza 
 Pozyskanym na poprzednim poziomie hasłem logujemy się do poziomu 14 . Tym razem dany jest formularz logowania. Mamy również wgląd w kod źródłowy: 
 <?
if (array_key_exists("username", $_REQUEST)) {
 $link = mysql_connect('localhost', 'natas14',…
Wpis jest kontynuacją rozwiązań hackme Natas na OverTheWire. Rozwiązania etapu 12 można znaleźć tutaj . 
 Analiza 
 Hasłem uzyskanym na poprzednim etapie logujemy się do kolejnego poziomu. Kod różni się nieznacznie względem tego w poprzednim przykładzie. Odwiedzając stronę informowani jesteśmy o wprowadzeniu weryfikacji, czy wysyłany plik jest obrazem. Kod źódłowy: 
…
Wpis jest kontynuacją rozwiązań hackme Natas na OverTheWire. Rozwiązania etapu 11 można znaleźć tutaj . 
 Analiza 
 Hasłem uzyskanym na poprzednim etapie logujemy się do kolejnego poziomu. Na tym poziomie mamy do czynienia z formularzem wstawiania plików na serwer. Spójrzmy na kod: 
 <?

function genRandomString()
{
 $length = 10;
…