Exploring Lamport's Bakery algorithm in Python

Marton Trencseni - Fri 11 July 2025 • Tagged with lamport, bakery, python, flask

This post shows how to implement Lamport’s Bakery algorithm with Python HTTP Flask servers. The Python code is short and readable, helping newcomers grasp the algorithm’s logic without the syntactic overhead of C++. The asynchronous HTTP flow also generates plenty of overlap between workers, so the need for mutual exclusion is obvious. Exposing the variables through REST endpoints enables observation of ticket picking and critical section entry in real time, potentially making the flow of the algorithm easier to understand.

Continue reading

Exploring Lamport's Bakery algorithm in C++20

Marton Trencseni - Sun 06 July 2025 • Tagged with lamport, bakery, c++

I explore Lamport’s Bakery algorithm and show how a naive C++20 implementation breaks on weak memory models, how to fix it with std::atomic, and how to implement bounded tickets.

Continue reading

Karpathy: AI is changing Software Engineering

Marton Trencseni - Thu 03 July 2025 • Tagged with software, ai, karpathy, hackernews

Andrej Karpathy says we’re marching from hand-written “Software 1.0” to NN-driven “2.0” and, finally, LLM-powered “3.0.” In my view, neural nets haven’t eaten deterministic code—kernels, browsers, games, and most business logic still run old-school. What has changed is the supply chain: LLM co-pilots (“Software 1.5”) already touch nearly every commit, nudging us towards language and architectures that LLMs are good at. The future belongs to teams that harness those co-pilots while keeping humans firmly on the trigger.

Kiugras Beugras

Continue reading

Writing a simple async message queue server in C++, Python and JavaScript — Summary

Marton Trencseni - Sat 21 June 2025 • Tagged with cpp, async, message, queue

I summarize thoughts and lessons learned of implementing the same async message queue server in C++, Python and JavaScript over the past 2 years.

.

Continue reading

Writing a simple C++20 async message queue server - Part III

Marton Trencseni - Fri 20 June 2025 • Tagged with cpp, async, message, queue

I write the final version of the async message queue server in modern C++20, wire compatible with the Python and Javascript versions.

.

Continue reading

White noise into random walks

Marton Trencseni - Sun 04 May 2025 • Tagged with trading, random walks

A visual and analytical walk from pure white noise to a true random walk.

.

Continue reading

Random Walks and the Dickey-Fuller Test - Part II

Marton Trencseni - Sat 26 April 2025 • Tagged with trading, random walks, dickey-fuller

The article examines how simple autoregressive stochastic processes behave with the Dickey-Fuller test.

.

Continue reading

Random Walks and the Dickey-Fuller Test - Part I

Marton Trencseni - Sun 20 April 2025 • Tagged with trading, random walks, dickey-fuller

This post explores how to use the Dickey–Fuller test to check the random‑walk hypothesis for time series using a pure NumPy implementation, and using Monte Carlo simulations to compute critical‑value tables.

.

Continue reading

The reward for long-term resilience in simple trading strategies - Part II

Marton Trencseni - Sun 16 March 2025 • Tagged with trading, sharpe ratio, win ratio, nasdaq

In this follow-up, I analyze 10 years of data on a select group of stocks to show that while higher take-profit and stop-loss thresholds boost win ratios and Sharpe ratios, longer holding times can lower annualized returns.

.

Continue reading

The reward for long-term resilience in simple trading strategies - Part I

Marton Trencseni - Sun 09 March 2025 • Tagged with trading, sharpe ratio, win ratio, nasdaq

In this article, I explore how adopting longer-term, resilient trading strategies with higher take-profit and stop-loss thresholds can deliver more consistent, risk-adjusted performance.

.

Continue reading

Culture talk: What I learned from building a distributed database that never took off

Marton Trencseni - Tue 31 December 2024 • Tagged with techtalk, startup, scalien, scaliendb, paxos, replication

Recently, I delivered a culture talk on Scalien, my old database startup that never took off. I discussed the business, product and some technical challenges and lessons learned from developing ScalienDB, a Paxos-based distributed NoSQL database.

100

Continue reading

Modern Portfolio Theory III: The Efficient Frontier in log volatility—return space

Marton Trencseni - Mon 30 December 2024 • Tagged with markowitz, portfolio, capm, volatility

In the previous two articles, we explored the coverage of random portfolios in log volatility—return space, both with and without a risk-free asset. We now take the next step, and calculate the Efficient Frontier and Capital Market Line of Markowitz’s theory.

Continue reading

The MMT Perspective on Crypto

Marton Trencseni - Fri 27 December 2024 • Tagged with mmt, crypto, bitcoin, btc, fiat

From an MMT (chartalist) perspective, cryptocurrencies lack sovereign backing and fail to establish the enforced demand necessary to function as true currency. Because they rely solely on speculative sentiment rather than legal mandates (like taxation), their values are unsustainable in the long run and risk ultimately collapsing to zero.

Continue reading

I ❤️ triathlons

Marton Trencseni - Thu 26 December 2024 • Tagged with meta

In 2008, I completed my first half-Ironman — then, later that same year, I took on the full Ironman distance at the traditional ExtremeMan in Hungary, finishing in 13 hours and 38 minutes. By 2013, I had knocked my time down to 11 hours and 36 minutes. Since then, I’ve racked up a total of 56 triathlon finishes. 2024 was one of the best years so far, with a record of 10 triathlon races.

100

Continue reading

Modern Portfolio Theory II: Random portfolio coverage in log volatility—return space with a risk free asset

Marton Trencseni - Fri 20 December 2024 • Tagged with markowitz, portfolio, capm, volatility

In a previous article I simulated random portfolios using Monte Carlo methods for the 2023 daily closing prices of the 100 stocks constituting the Nasdaq-100. Here I add the risk-free asset to the portfolio and examine how it affects the coverage in log volatility—return space.

Continue reading

Individual Career Plan

Marton Trencseni - Sun 15 December 2024 • Tagged with leadership, people, management

This post provides a practical Individual Career Plan template you can use to guide self-assessment, prioritize your professional development, and set meaningful goals that align with your vision for the future. By outlining clear objectives and action steps, you create a framework for continuous improvement and more informed career decisions. I use this same template for the data organization I lead, filled it out myself, and shared it with others to inspire them to do the same.

Desert road sunset

Continue reading

Why I read history books

Marton Trencseni - Mon 09 December 2024 • Tagged with hungary, politics, history

Hungary’s rushed entry into World War II and its botched attempt to break away from it show how stale leadership trapped in its own fantasy bubble can steer a nation toward disaster. By “political backtesting” these moments — comparing their underlying factors to the present — today’s citizens can weigh future outcomes, draw practical lessons, we can make more informed decisions about where and how to live.

Kiugras Beugras

Continue reading

Paper: The Unreasonable Effectiveness of Monte Carlo Simulations in A/B Testing

Marton Trencseni - Thu 05 December 2024 • Tagged with ab-testing

I run Monte Carlo simulations of content production over random Watts-Strogatz graphs to show various effects relevant to modeling and understanding Randomized Controlled Trials on social networks: the network effect, spillover effect, experiment dampening effect, intrinsic dampening effect, clustering effect, degree distribution effect and the experiment size effect. I will also define some simple metrics to measure their strength. When running experiments these potentially unexpected effects must be understood and controlled for in some manner, such as modeling the underlying graph structure to establish a baseline.

Continue reading

Modern Portfolio Theory I: Random portfolio coverage in log volatility—return space

Marton Trencseni - Sun 01 December 2024 • Tagged with markowitz, portfolio, capm, volatility

I examine the coverage of random portfolios in log volatility—return space using Monte Carlo methods with different randomization techniques for the 2023 daily closing prices of the 100 stocks constituting the Nasdaq-100.

Monte Carlo casino

Continue reading

The Unreasonable Effectiveness of Monte Carlo Simulations in A/B Testing

Marton Trencseni - Sun 20 October 2024 • Tagged with ab-testing

The article illustrates how Monte Carlo simulations serve as a powerful method for exploring statistical concepts in A/B testing, enhancing understanding, improving experimental design and analysis.

Monte Carlo casino

Continue reading