andrei's Avatar

andrei

@markeev.com.bsky.social

Principal full-stack engineer who codes for 25+ years, both professionally and as a hobby. - TypeScript and C - NGINX, Kubernetes, Nodejs, MongoDB, MySQL - Vue, React - Webdev, compilers and IDEs, IoT and wearables, gamedev, etc

18 Followers  |  5 Following  |  60 Posts  |  Joined: 06.11.2024  |  1.9454

Latest posts by markeev.com on Bluesky

Dan is out here making the arguments for RSC I never knew I needed to hear.

01.06.2025 01:09 β€” πŸ‘ 5    πŸ” 1    πŸ’¬ 0    πŸ“Œ 0
Preview
Smashing the state machine: the true potential of web race conditions For too long, web race condition attacks have focused on a tiny handful of scenarios. Their true potential has been masked thanks to tricky workflows, missing tooling, and simple network jitter hiding

A nice write up on the race conditions attacks. While with a single data store, you can tackle those with transactions, but multiple data stores are much harder to secure. portswigger.net/research/sma...

31.01.2025 11:25 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
How to do distributed locking β€” Martin Kleppmann’s blog

Good points on distributed locking: martin.kleppmann.com/2016/02/08/h...

26.01.2025 09:24 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Turns out you can do grps mirroring with #nginx: inge.4pr.es/grpc-traffic...

I wonder if same trick can be used for websocket mirroring.

25.01.2025 20:18 β€” πŸ‘ 1    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0
Exploring V8's strings: implementation and optimizations | iliazeus Exploring V8's strings: implementation and optimizations. Beating c++ with js in a totally 100% legit way. iliazeus

#javascript strings are faster than c++ strings! (sometimes): iliazeus.lol/articles/js-...

21.01.2025 17:26 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

This is very 5head but super interesting! 🀩 It’s crazy how people learned to exploit things you would never think are exploitable in the first place... #javascript pure.tugraz.at/ws/portalfil...

21.01.2025 16:44 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

it returns undefined, because return statement doesn’t allow line break right after return. thankfully, modern IDEs will most likely give you a squiggly warning or even error, depending on your settings.

21.01.2025 16:00 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

the modern web yep πŸ€¦β€β™‚οΈ

20.01.2025 06:16 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Breaking down OpenAI's outage: How to avoid a hidden DNS dependency in Kubernetes Learn how to prevent Kubernetes outages by addressing hidden DNS dependencies and control plane issues. We break down OpenAI's recent incident, share key lessons from our own Kubernetes experience, an...

A very nice writeup on the OpenAI’s incident with #kubernetes control plane going down: render.com/blog/a-hidde...

17.01.2025 12:52 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Ingress nginx scaling to max due to memory Β· Issue #12167 Β· kubernetes/ingress-nginx Hi All, We observe a strange behaviour with the ingress-nginx pods in our production. We started observing the pods scaling to max due to memory usage. EKS: 1.29 helm list -n ingress-nginx NAME NAM...

Just faced this: Nginx ingress controller consumes a lot of memory during configuration changes (e.g. when creating ingresses). Which can lead to pods getting killed with out of memory error 😱

It is quite insane considering that NGINX is a very memory efficient server

github.com/kubernetes/i...

14.01.2025 16:32 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Some very interesting details there!
- to avoid a need for source maps, type annotations are replaced with spaces
- swc is used to do the actual stripping. one can say that swc is now shipped as part of Node.js πŸ˜„
- enums behaviour
- why tsx files are not supported

…and so on

13.01.2025 16:05 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I disable js in Chrome Dev Tools or use text browser e.g. lynx

13.01.2025 08:11 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image Post image

Today's daily challenge on leetcode is really hard! If you like to do some morning brain racking, this challenge is for you! πŸ˜…

I am actually quite proud I was able to solve it. Saw a guy on Twitch who streams leetcode challenges for 24 days in a row and he couldn't solve it 🀯

I used #typescript.

13.01.2025 08:08 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Can you fit Minecraft in a QR code? Answer: Yes! Here it is: The game launches, and you can move around the 64x64x64 world with WASD. Space is used to jump. Look around wit...

This is so cool… Minecraft that fits in a single QR code (2953 bytes): blog.allpurposem.at/minecraft-qr

10.01.2025 05:31 β€” πŸ‘ 1    πŸ” 1    πŸ’¬ 0    πŸ“Œ 0
Preview
1-billion row challenge with Node.js 5 minutes to 11 seconds with Node.js is possible?

I was fascinated by the 1-billion row challenge, but didn't think JavaScript would be the right tool for the job. It was great to see @jackyef.com's dive into it and achieve a 30x speedup from the baseline: jackyef.com/posts/1brc-n...

07.01.2025 22:55 β€” πŸ‘ 6    πŸ” 1    πŸ’¬ 0    πŸ“Œ 0
ts2c - Convert JavaScript/TypeScript to C

I also released ts2c 2.2.10 to npm - that's gonna be the last version based on TypeScript most likely.

The online demo at andrei-markeev.github.io/ts2c/ is using 2.2.10 for now.

04.01.2025 00:49 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
GitHub - andrei-markeev/ts2c: Convert Javascript/TypeScript to C Convert Javascript/TypeScript to C. Contribute to andrei-markeev/ts2c development by creating an account on GitHub.

Just merged a massive change in ts2c, migration from TypeScript Compiler API to kataw - faster and more lightweight JS parser πŸš€

Two weeks of hard work finally materialised. If I knew it would be that hard, I would probably never start πŸ˜… But I did it πŸ’ͺ

github.com/andrei-marke...

04.01.2025 00:49 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Even though I despise dynamic forms, but I built a dynamic forms engine myself about 3 years ago, to replace manually built forms πŸ€·β€β™‚οΈ

The use case literally demanded it.

It was a long onboarding wizard with huge amount of customization per location, and we had hundreds of locations.

02.01.2025 21:36 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Ah so it was form generation from a schema?

Yeah I wholeheartedly agree that in 95% cases it's better to make forms manually. Like write them in JSX. If non-devs want to do it, there's e.g. Figma and then devs can brush up the result.

However, there are different use cases too.

02.01.2025 21:36 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

sounds actually like a cool project to me :)

I did "intelligent" forms several times, for React and Vue, but never had to work with AST transforms for this, typings were enough.

it might be challenging, but why horrible?

02.01.2025 20:38 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

used it in ts2c: github.com/andrei-marke...

02.01.2025 15:55 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image

#typescript has a very handy feature: it can merge interfaces, even with external libs.

I regularly forget how to make it work with modules, so here's the reminder πŸ˜‰

Btw: `declare global` is also super useful 😎

02.01.2025 15:30 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I am actually quite proud of myself:

1. Investing a lot of hard work and still being able to withdraw is not easy.

2. Learned quite a bit about #javascript performance from this exercise :)

02.01.2025 13:19 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Spent 2 days (ok, nights πŸ€ͺ) rewriting type inference system in ts2c to a new "super efficient and more debugabble" implementation.

Measured performance. Unchanged πŸ˜…

Tried debugging it. Still very hard.

Rolled back the changes πŸ€·β€β™‚οΈ

02.01.2025 13:19 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Documentation - Narrowing Understand how TypeScript uses JavaScript knowledge to reduce the amount of type syntax in your projects.

Person is not a class, you can't use `instanceof` on interfaces πŸ˜‰

Type guards can be used instead: www.typescriptlang.org/docs/handboo...

02.01.2025 12:50 β€” πŸ‘ 6    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

Also don't forget to make sure that `NaN !== NaN` ! πŸ˜‚

01.01.2025 03:34 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
GitHub - ParksProjets/C-Preprocessor: This is a C like preprocessor for Javascript, using Node.js This is a C like preprocessor for Javascript, using Node.js - ParksProjets/C-Preprocessor

Combine this with a clone of C preprocessor in JS (and maybe GNU make as well) github.com/ParksProjets...

Currently we don't have any preprocessors in JS and we cannot easily eliminate e.g. debug logging from production bundle.

01.01.2025 03:32 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
ES6 modules are dead, long live C preprocessor! Did you know you could use C preprocessor even for JavaScript files?

Yesterday stumbled upon this funny idea of using `#include` in JS to bundle files with C preprocessor, thought "haha, nice", and closed the tab.

I guess my brain kept thinking about it πŸ˜… I woke up and now I think it is a really interesting idea actually πŸ€ͺ

rreverser.com/es6-modules-...

01.01.2025 03:32 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
screenshot of `git log` commands, the most recent commit named "migrate to kataw WIP" showing that there were 54 files changed, with 1927 insertions and 1457 deletions

screenshot of `git log` commands, the most recent commit named "migrate to kataw WIP" showing that there were 54 files changed, with 1927 insertions and 1457 deletions

Current status: fixed 700+ typescript errors, phew πŸ˜…

Doing a big ass migration from using #Typescript Compiler API to a faster and more compact js parser (kataw) in TS2C.

30.12.2024 21:42 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image

Btw, fun fact: back in 2000s, I wrote a compiler. It was a long multi-year project. I even used it to compile executables for my own operating system.

And I guess because I was programming in Perl a lot in beginning of 2000s, the language didn't have ANY keywords πŸ˜…

Everything was special symbols πŸ˜‡

27.12.2024 20:28 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

@markeev.com is following 5 prominent accounts