HN user

michidk

701 karma

michael@lohr.dev https://lohr.dev

meet.hn/city/de-Munich

Socials:

- https://github.com/michidk/

- https://www.linkedin.com/in/michael-lohr/

- https://x.com/miichidk/

Interests:

Cloud, Entrepreneurship, IoT, Open Source, Programming, Startups, Web Development, Freelancing

Posts95
Comments59
View on HN
github.com 2mo ago

Show HN: Hodor – A tiny reverse proxy that gates any web app behind a password

michidk
1pts0
github.com 3mo ago

Scalable CLI – an official command line for the Scalable Capital broker

michidk
2pts0
github.com 3mo ago

Rig: Build modular LLM apps in Rust – 20 providers, one unified interface

michidk
5pts1
github.com 3mo ago

Show HN: Orcastrate – Sync GitHub Actions workflows across repos via templates

michidk
6pts0
news.ycombinator.com 3mo ago

Ask HN: LLM-Based Spam Filter

michidk
4pts1
github.com 3mo ago

A self-hosted travel/trip planner with real-time collaboration

michidk
1pts0
blog.lohr.dev 6mo ago

HashiCorp killed my favorite IaC Tool

michidk
2pts0
github.com 6mo ago

Rust macro to generate AI code at compile-time

michidk
2pts0
code.visualstudio.com 6mo ago

VSCode rebrands as "The open source AI code editor"

michidk
103pts76
blog.lohr.dev 8mo ago

Web Dev Has Never Been This Easy

michidk
4pts0
www.home-assistant.io 9mo ago

Home Assistant deprecates Core and Supervised installation methods, and 32-bit

michidk
2pts0
github.com 11mo ago

An encyclopedia where every article is generated on the spot

michidk
1pts0
isle.pizza 1y ago

Lego Islands Running as Website

michidk
6pts1
linear.app 1y ago

Write issues not user stories

michidk
2pts0
ui.bazza.dev 1y ago

Data table filters based on shadcn/UI and TanStack Table

michidk
1pts0
blog.lohr.dev 1y ago

The Case Against Character Count Line Limits

michidk
1pts3
blog.lohr.dev 1y ago

How IMAP works under the hood

michidk
238pts75
github.com 1y ago

A cross-platform multi-target dotfiles manager written in Rust

michidk
81pts81
github.com 1y ago

A CLI to quickly launch VSCode/cursor devcontainers

michidk
49pts23
oklch.com 1y ago

Oklch Space Color Picker

michidk
1pts0
blog.lohr.dev 1y ago

Embedded TypeScript: Hosting a Front End on a ESP32 (2024)

michidk
1pts0
www.youtube.com 1y ago

I Will Not Write Rust Again [video]

michidk
7pts6
blog.lohr.dev 1y ago

The smallest Hello World program

michidk
76pts49
blog.lohr.dev 1y ago

Talking to your mailserver is not as hard as you think

michidk
6pts2
news.ycombinator.com 1y ago

Ask HN: Do you backup your Emails?

michidk
32pts76
blog.lohr.dev 1y ago

Are character count line limits stupid?

michidk
2pts3
blog.lohr.dev 1y ago

Embedded TypeScript on a ESP32

michidk
1pts0
blog.lohr.dev 1y ago

Embedded Rust in Production?

michidk
205pts287
blog.lohr.dev 1y ago

Reverse engineering Microsoft's dev container CLI (2023)

michidk
1pts0
blog.lohr.dev 1y ago

Show HN: The Case Against Character Count Line Limit

michidk
2pts3

Yes, exactly this! We are actually spending soo much time deriving, thinking, formulating & refining OKRs from roadmap items that we could just declare as simple "Goals". We could get so much shit done during that time.

Most of the time as the quarter goes on, we then scrap those OKRs anyway because we didn't manage to do them or they were too specific and requirements changed.

I always had the feeling that what we are doing is bullshit. So great to finally hear it from someone else.

I wonder how many engineering companies actually use OKRs though.

okay, I didn't know that, thanks for the background. I wonder why the assembler would not optimize this though.

I noticed that I then could also shave of one byte more by using lea esi, [rel msg] instead of lea rsi, [rel msg].

I think your statement might only apply to 32 bit (one of the constraints mentioned early in the blog post was 64 bit).

But even if it was 32 bit, then we would't have to copy a 1, since the syscall number for sys_write would be 4 instead of 1.

I get the same total size with both variants in 64 bit mode.

  push 1
  pop rax
  mov rdi, rax
Assembling to 48 89 C7 (3 bytes)

seems to be same in size as

  push 1
  pop rax
  push 1
  pop rdi
Assembling to 6A 01 5F (3 bytes)

Of course - you are completely right, an oversight in wanting to correct my mistake as quickly as possible.

With that fixed, is there any reason not to use push here?

Yeah I thought sth like this is possible, but (correct me if I'm wrong) this (ab)uses the ELF header and punts data in there, which goes against my requirement

It should be a ‘proper‘ executable binary according to the spec

I was able to shave off one additional byte with this:

  ...
  xor rax, rax       ; = 0
  inc rax            ; = 1 - syscall: sys_write
  mov rdi, rax       ; copy 1 - file descriptor: stdout
  lea rsi, [rel msg] ; pointer to message
  mov rdx, 14        ; message length
  syscall
  ...

  $ nasm -f bin -o elf elf.asm; wc -c elf; ./elf
  166 elf
  Hello, World!
So I guess NASM already optimizes this quite well

However, using the stack-based instructions as xpasky hinted at:

  ...
  push 1             ; syscall: sys_write
  pop rax
  pop rdi       ; copy 1 - file descriptor: stdout
  lea rsi, [rel msg] ; pointer to message
  push 14            ; message length
  pop rdx
  syscall
  ...
I get down to 159 bytes! I updated the article to reflect that

Thanks, that makes total sense. I was so focused on the ELF part that I didn't even consider optimizing the initial assembly further. Will fix it and edit the article.

There are actually IDE plugins which perform 'semantic line wrapping'. But that is besides the point. Of course, it can make sense to add manual line wraps, especially if the developer intends to make his intentions clearer by using line breaks at specific points.

But lots of developers use formatting plugins to force line breaks anyways - and they are no better then the IDE linewrapping.

Code is of course powerful, but I’ve found the restrictive nature of Terraform’s HCL to be a benefit with reduced complexity.

No way. We used Terraform before and the code just got unreadable. Simple things like looping can get so complex. Abstraction via modules is really tedious and decreases visibility. CDKTF allowed us to reduce complexity drastically while keeping all the abstracted parts really visible. Best choice we ever made!

Divi Theme with Wordpress is great. Allows for quick prototyping but is used for many production websites as well.