Skip to content

Instantly share code, notes, and snippets.

View lemanschik's full-sized avatar
🚀
I Invent Coding Solutions. Languages, Tools, You name It

Frank Lemanschik lemanschik

🚀
I Invent Coding Solutions. Languages, Tools, You name It
View GitHub Profile

Achieving synchronized audio and video playback is a complex but crucial task in multimedia programming. With a framework like PipeWire, which is designed to handle all types of media streams, synchronization is a core concept. The key to this is understanding the role of Presentation Timestamps (PTS) and a shared clock.

Here’s a breakdown of the concepts and a step-by-step guide on how to approach A/V sync when creating a C++ player with PipeWire.

The Core Concept: A Common Clock and Timestamps

Imagine you have two separate players: one for video frames and one for audio samples. To keep them in sync, you can't just play them as fast as possible. Instead, you need a shared "wall clock" that both players can look at.

  1. The Clock: PipeWire provides a global clock for the entire media graph. This clock is typically driven by an audio device (like your sound card) because audio playback is very sensitive to timing errors. If audio samples aren't delivered at a precise, steady rate, you get

Of course. Exposing a full Wayland compositor like Hyprland from inside a Docker container is an advanced and interesting challenge. It goes against Docker's typical use case of isolating server applications, as it requires deep access to the host's hardware (GPU, input devices) and a way to stream the graphical output.

This is a great educational exercise in understanding container isolation and how to selectively break it for specific purposes like testing a desktop environment. I will guide you through the concepts and a practical, safe example.

Disclaimer: This process involves giving the Docker container privileged access to your host's hardware devices (/dev/dri, /dev/input). This significantly reduces the security and isolation benefits of Docker. Only run trusted images with these flags.

The Core Challenges

  1. Graphics Hardware Access: Hyprland needs to communicate directly with the GPU to render frames. A standard Docker container has no access to /dev/dri (Direct Rendering Inf

Perfect — Fallout Tactics then. 👍

In Fallout Tactics, .MIS files are mission/map files, basically containers for:

  • Header info → version, map size, checksum.
  • Tiles → terrain grid, elevation, blocking.
  • Entities → units, items, containers, scenery, doors.
  • Triggers → scripts/events, mission objectives.
  • Strings → text (mission descriptions, dialogue references).
@lemanschik
lemanschik / hier.md
Created September 15, 2025 11:24
woocomerce

Of course. This is a very common and excellent goal for creating custom landing pages or unique store layouts.

The "easy way" depends on which WordPress editor you are using. I'll break it down from the most modern and recommended method to the classic one.

The key misunderstanding to clear up first is that WooCommerce does not have individual shortcodes for every single element like [product_price id="99"] out of the box.

Instead, you either use the main [product_page] shortcode (which has limitations) or, much more effectively, you use blocks or page builder widgets.


@lemanschik
lemanschik / quiz.md
Created September 14, 2025 20:57
here

Of course! A good name should be memorable, easy to spell, and hint at what the tool does. Here are several categories of names for a JS quiz maker, from developer-focused to more creative options.

For Developers (JS & Tech-Focused)

These names leverage JavaScript terminology and will appeal directly to developers.

  • Quiz.js: A classic, simple name that follows the convention of many popular JS libraries (like Chart.js, Three.js).
  • ScriptedQuiz: Implies that the quizzes are created with code and logic.
  • QueryQuest: Combines "query" (a common programming term) with "quest" (a fun word for a quiz).
  • FormaScript: A blend of "form" and "JavaScript," sounding both professional and descriptive.

PipeWire can have an "available delay" or latency, which is user-configurable through environment variables like PIPEWIRE_LATENCY by setting a buffer size and sample rate. Users can set PIPEWIRE_LATENCY="<buffer_size>/<sample_rate>" to specify the desired latency in seconds. Lower buffer sizes reduce latency but can increase CPU usage and risk audio glitches, while larger buffer sizes increase latency but improve stability. This video demonstrates how to set the buffer size and sample rate in PipeWire to reduce latency:

https://www.youtube.com/watch?v=CVADCqkW9Xs

How to Control Latency in PipeWire Use the PIPEWIRE_LATENCY Environment Variable This is the most direct way to request a custom buffer size and latency for applications. You need to set it before launching the application. For example, to set a buffer of 128 frames at a 48kHz sample rate, you would use PIPEWIRE_LATENCY="128/48000" application.

@lemanschik
lemanschik / removal_32.md
Created September 12, 2025 19:12
removal

IBM-compatible personal computers with Intel 80486 (i486) CPUs

Early Intel Pentium (P5/i586) machines

AMD 486-based systems (e.g., Am486, Elan SC400/SC410/SC450)

Cyrix 5x86 and 6x86 computers

VIA/Centaur C3/Cyrix III and WinChip PCs

@lemanschik
lemanschik / README.md
Last active September 10, 2025 05:33
Leetcode

An elegant way to solve this problem is to use a greedy approach. The goal is to minimize the number of deletions, which is equivalent to maximizing the number of elements we keep. We can build the longest possible "beautiful" subsequence by iterating through the input array nums from left to right.

Let's call the beautiful array we are constructing res. We'll process each number from nums and decide whether to add it to res.

The rules for a beautiful array depend on the new indices of the elements, specifically whether an index i is even or odd. This suggests that our decision to keep an element should depend on the current length of our res array.

Here's the greedy strategy:

  1. Initialize an empty list, let's call it beautiful_seq, which will store the elements we decide to keep.
  2. Iterate through each number num in the input array nums.
@lemanschik
lemanschik / vallheim_map.md
Created September 2, 2025 06:25
Example vallheim

Of course! This is a fantastic project. Here is a complete, self-contained HTML file that includes the CSS and JavaScript to do exactly what you want.

You can save this code as a single visualizer.html file and open it in your web browser. It will work entirely locally; no web server is needed.

Key Features of this Example:

  • File Pickers: Allows you to upload your map image (.png, .jpg) and your server log file.
  • Log Parser: Uses a Regular Expression to find all player position entries in the log.
  • Canvas Drawing: Renders your map and draws the parsed path on top of it.
  • Interactive Calibration: Includes input fields for you to tweak the scale and map dimensions in real-time to get a perfect alignment.
  • Clear Instructions: Guides you on how to find the correct calibration values.
@lemanschik
lemanschik / vallheim.md
Created September 2, 2025 06:21
vallheim.md

Excellent question! You've run into a classic problem in game map visualization, and your intuition is spot on. The "rounded map" is the absolute key to understanding the offset.

Let's break down exactly what's happening and how to fix it.

The Core Problem: Mismatched Coordinate Systems

You are dealing with two different coordinate systems:

  1. In-Game World Coordinates: These are the raw (X, Y, Z) coordinates your log parser is correctly reading. For a top-down map, we only care about (X, Z). This system is a perfect, flat Cartesian grid where the center of the world is (0, 0).
  2. Map Image Pixel Coordinates: This is the coordinate system of the PNG or JPEG file of your map. The origin (0, 0) is at the top-left corner. X increases to the right, and Y increases downwards.