Readit News logoReadit News
2bluesc commented on If you're going to vibe code, why not do it in C?   stephenramsay.net/posts/v... · Posted by u/sramsay
2bluesc · 6 days ago
Traditionally, I used Python for personal tools optimizing for quick coding and easy maintenance. These tools commonly feed UI elements like waybar, shell, and tmux, requiring frequent, fast calls.

My approach is evolving due to NixOS and home-manager with vibe coding to do the lifting. I increasing lean on vibe coding to handle simple details to safely write shell scripts (escaping strings, fml) and C/C++ apps. The complexity is minimized, allowing me to almost one-shot small utilities, and Nix handles long-term maintenance.

With NixOS, a simple C/C++ application can often replace a Python one. Nix manages reading the source, pulling dependencies, and effectively eliminating the overhead that used to favor scripting languages while marking marginal power savings during everyday use.

2bluesc commented on Ask HN: Local hostnames without root/admin    · Posted by u/terry_hc
GoblinSlayer · 3 months ago
If your programs use glibc, it supports hosts overrides in an environment variable, forgot which.
2bluesc · 3 months ago
`HOSTALIASES` lets you alias hostnames, but not map hostnames to IPs.

Docs at `man gethostbyname`

https://man7.org/linux/man-pages/man3/gethostbyname.3.html

2bluesc commented on Ask HN: Local hostnames without root/admin    · Posted by u/terry_hc
2bluesc · 3 months ago
You can use the linker to preload `nss_wrapper`[0] and overwrite anything using `nss`.

Here's an example:

  > cat hosts
  198.51.100.33 test.tld
  2001:db8::33 test.tld
  198.51.100.12 test4.tld
  2001:db8::12 test6.tld

  > LD_PRELOAD=/nix/store/sw2r0gpi9c9rsvqgvi4906yxh948ydsv-nss_wrapper-1.1.16/lib/libnss_wrapper.so NSS_WRAPPER_HOSTS=hosts getent ahosts test.tld
  198.51.100.33   DGRAM  test.tld
  198.51.100.33   STREAM test.tld
  2001:db8::33    DGRAM
  2001:db8::33    STREAM

  > LD_PRELOAD=/nix/store/sw2r0gpi9c9rsvqgvi4906yxh948ydsv-nss_wrapper-1.1.16/lib/libnss_wrapper.so NSS_WRAPPER_HOSTS=hosts getent ahosts test4.tld
  198.51.100.12   DGRAM  test4.tld
  198.51.100.12   STREAM test4.tld

  > LD_PRELOAD=/nix/store/sw2r0gpi9c9rsvqgvi4906yxh948ydsv-nss_wrapper-1.1.16/lib/libnss_wrapper.so NSS_WRAPPER_HOSTS=hosts getent ahosts test6.tld
  2001:db8::12    DGRAM  test6.tld
  2001:db8::12    STREAM test6.tld

  > LD_PRELOAD=/nix/store/sw2r0gpi9c9rsvqgvi4906yxh948ydsv-nss_wrapper-1.1.16/lib/libnss_wrapper.so NSS_WRAPPER_HOSTS=hosts curl -v test.tld
  * Host test.tld:80 was resolved.
  * IPv6: 2001:db8::33
  * IPv4: 198.51.100.33
  *   Trying [2001:db8::33]:80...
  *   Trying 198.51.100.33:80...

[0] https://cwrap.org/nss_wrapper.html

2bluesc commented on Thingino: Open-Source Firmware for IP Cameras   thingino.com/... · Posted by u/zakki
2bluesc · 4 months ago
Here's a good YouTube overview from the developer

https://youtu.be/QQV6vjzhylg

This looks like a great project!

u/2bluesc

KarmaCake day3258January 24, 2011
About
Embedded Linux Systems guy that likes to hack on bikes, drones, security, networking, and more
View Original