Skip to content

Instantly share code, notes, and snippets.

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@gtrsh
gtrsh / minio_backup_restore_guide.md
Created March 24, 2025 14:54 — forked from MahdadGhasemian/minio_backup_restore_guide.md
Steps to backup and restore Minio Buckets

Restore Backup with Minio (Minio <----> Local)

Instructions for restoring buckets using Minio mirror features.

Install Minio Client

Install Link install link

Linux AMD64 DEB:

Running Windows 10/11 Guest with GPU Passthrough using laptop running Fedora

Abstract

This is a full guide for people who wanted to set up Windows 10/11 VM with QEMU/KVM hypervisor enhancements for a laptop that is configured with hybrid graphics card like Intel/AMD + NVIDIA. This process will take about 1 to 2 hours, depending on your system's performance and your patience =)

There is another comprehensive guide you can follow here (shoutout to asus-linux team who made supergfxctl which is a very important tool for this guide). It is more up-to-date than mine. I would probably incorporate those information into my guide, but you are welcome to use this one as a reference!

Before we proceed:

  • This guide is exclusively for Fedora users because this distro is quite different to set up than other distro such as Arch. I would say Arch is easier to setup than Fedora, but sometimes you like to use Fedora than Arc
@gtrsh
gtrsh / building-sync-systems.md
Created December 9, 2024 15:43 — forked from pesterhazy/building-sync-systems.md
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

<script>
var module = WebAssembly.instantiateStreaming(fetch("linked_list.wasm"), {});
</script>
@gtrsh
gtrsh / di-in-fp.md
Created August 29, 2022 02:30 — forked from gvolpe/di-in-fp.md
Dependency Injection in Functional Programming

Dependency Injection in Functional Programming

There exist several DI frameworks / libraries in the Scala ecosystem. But the more functional code you write the more you'll realize there's no need to use any of them.

A few of the most claimed benefits are the following:

  • Dependency Injection.
  • Life cycle management.
  • Dependency graph rewriting.
@gtrsh
gtrsh / promise_monad.md
Created June 20, 2021 17:18 — forked from VictorTaelin/promise_monad.md
async/await is just the do-notation of the Promise monad

async/await is just the do-notation of the Promise monad

CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.

In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.

First, let's illustrate the 3 styles by implementing

@gtrsh
gtrsh / questions_for_interview.md
Created June 19, 2021 18:22 — forked from romanitalian/questions_for_interview.md
Questions for interview - Вопросы для собеседования
Вопросы по шаблонам проектирования:
  • Почему глобальные объекты и статика — это зло? Можете показать на примере кода?
  • Расскажите об инверсии управления и как она улучшает организацию кода.
  • Закон Деметры (Принцип минимальной информированности) гласит, что каждый программный модуль должен обладать ограниченным знанием о других модулях и должен взаимодействовать только с непосредственными «друзьями» (иногда его формулируют как «Не разговаривай с незнакомцами»). Можете написать код, который нарушает этот принцип? Почему у него плохая организация и как её исправить?
  • Active-Record — шаблон проектирования, который поощряет внедрение в сам объект функций, таких как Insert, Update и Delete, и свойств, которые соответствуют столбцам некоей базовой таблицы в базе данных. По вашему мнению и опыту, какие ограничения и подводные камни у этого шаблона?
  • Data-Mapper — шаблон проектирования, который поощряет использование слоя преобразователей (mappers), перемещающих данные между объектами и базой данных, в то же
Вопросы по шаблонам проектирования:
  • Почему глобальные объекты и статика — это зло? Можете показать на примере кода?
  • Расскажите об инверсии управления и как она улучшает организацию кода.
  • Закон Деметры (Принцип минимальной информированности) гласит, что каждый программный модуль должен обладать ограниченным знанием о других модулях и должен взаимодействовать только с непосредственными «друзьями» (иногда его формулируют как «Не разговаривай с незнакомцами»). Можете написать код, который нарушает этот принцип? Почему у него плохая организация и как её исправить?
  • Active-Record — шаблон проектирования, который поощряет внедрение в сам объект функций, таких как Insert, Update и Delete, и свойств, которые соответствуют столбцам некоей базовой таблицы в базе данных. По вашему мнению и опыту, какие ограничения и подводные камни у этого шаблона?
  • Data-Mapper — шаблон проектирования, который поощряет использование слоя преобразователей (mappers), перемещающих данные между объектами и базой данных, в то же