Proud of my corner.

it always itched me that my old personal website really did not look like i wanted to. it felt like something i just threw out, just so i can have a personal website.

today I sat down, and worked on a completely re-vamped site. and i am proud to say, that i am really happy with how it turned out. would be happy to hear other web-devs opinion on it, and how to improve! Heads up, its a single page.

https://mertk.uk

reddit.com
u/xerrs_ — 11 days ago

I coded in C, and it (me) crashed my laptop

Now I have been coding C for a while, so I do know a lot of solutions to specific problems. But to be honest, most of the time I look back at my old code, copy paste, and then re-factor it depending on my current project. I used SHM for my cherries(.)works Pulse project. The reason for that was, Pulse ran on two separate processes; One was the daemon that ran the monitoring in the background, and the renderer, who read the monitored data, and, as the name suggests, rendered it onto the terminal. Because they were two separate processes (which was required, because they both had a while loop), their virtual memory space was not the same, so I had to learn about SHM, however, that was a while ago... So when I started working on Deploy again, and then I needed the same thing again, I was too lazy to look it up again, so I just copied it, pasted it, and moved on.

cherries(.)works Deploy is as you might have guessed a project for deployment. Pretty fun project for me, and very important to manage memory, and processes, especially for this project. I "copied" the architecture for Pulse to Deploy, however the only difference is that Deploy has 3 processes, one is the management process, WITHIN the management process the deployed project is also a separate process. And then the render process. So thats a lot of processes that share a specific chunk of memory. So I not only copied the architecture, but also the SHM method, exactly the way I did in Pulse.

However, I must have forgotten something, I wasnt that sure though, but the crash did happen, everytime I entered a config file that was invalid. I fiddled around with the return values, tried to exit early, and even then, the crash still somehow found its way in. Finally, the smoking gun revealed itself to me.

My own "stop" function, is helpful to me, as it kills the process, and then deletes the file that stored the PID within a folder. While that was running at the end of the main function, within the forked processes, the SHM updated the pids to "-1" if they were invalid. Let me just show you the first line of my stop function;

void stop(pid_t pid)
    kill(pid, SIGKILL);
...

Yeah, I did not know this, but running kill(-1, SIGKILL); in C (or Linux), means; send SIGKILL to every process the caller is permitted to signal, except itself... Well, my laptop did not crash then, I made it crash by either killing every single process, or until an error happened. So yeah, I added a check to see whether or not the pid is a negative number, if it is, I return. Problem was solved.

What that little rodeo taught me, was that C is really not forgiving. Especially, when it does something you told it to. I mean, I did tell it to "kill(-1, SIGKILL)", meaning kill everybody except me (in the computer). I gotta be more careful with the dangerous code that I write...

TLDR; Tried to make my own stop function, did not add a check for negative PIDs. Whole laptop exited....

reddit.com
u/xerrs_ — 2 months ago

How to, not feel empty about programming, and not fear the future.

I have been programming since I was 14 years old, it started of very simple with discord bots, and now has spiraled into something completely different. Currently, as a 19 year old, I have the best future in my eyes, because I turned my hobby into my job. In the upcoming weeks I will start my so called "dualesstudium", where I will be studying at a University, whilst working for a company, and it is all about IT.

During these 5 years, I learned everything from programming websites, to apps, to learning registers, and assembly, to how to set up a server, how to hack into one, to learning C, and simple raspberrypi configurations, to camera modules, to low-level-architecture and yada yada. It is currently 3 AM, and this is the third time where I just stare blank at my laptop. I have finished numerous projects, working on other ones, but I am just feeling a little empty? I used to program up to 4 or even up to 8 hours a day, and in the last couple of days it feels as if I have a full block. I dont want to abandon my projects, because I love them, but I always find myself starting at those projects, changing 5 LoC, and then being confused on what to do. I am a Solo Developer, always have been one, mostly because I like to plan and manage myself (though that is gonna change anyway once the dualesstudium starts). But I really feel like advice from other programmers would do me REALLY good right now. Guessing that the most default answer here would be something like "Take a break", or "Find yourself", or "Stop fricking programming for 8 hours a day, that stuff is how you burnout the fastest", however, I am fearful of my future. I am 19 years old, and for me it already feels like time is running out. IT is a fast market, and it feels like if I am not moving fast enough, I am gonna miss the train that is gonna help me generate wealth. I love my parents, they did everything for me, and I really want to pay them back big, which is also why I put a lot of stress on me.

The older you are the wiser you get, is atleast what I would guess. Any old persons, or just people older than me, who have maybe had the same experience as me; Do you guys have any advice for me?

reddit.com
u/xerrs_ — 2 months ago

C is way more different than I thought

I have had a lot of experience with Zig, and a bit of Assembly for a while now. Just 1 1/2 months ago I started coding in C, because it is a must-have for my upcoming job. I have a Zig project that decompresses a PNG from scratch, and I thought it would be a good learning experience to do the same with C. Tbh, I thought it will be a simple slide, but as it turns out; it really is not.

While Zig got heavily inspired by C, it differs from its features and API. C has a lot of headers for different things (such as stdio.h / stdlib.h / math.h), while Zig just has the std library, packaged with all of the other necessities (std.Io / std.math / std.crypto etc.). It was also interesting from going to using defer, errdefer, orelse, or other keywords in Zig that help in reducing bugs and make the code cleaner to read, to a lot less keywords. Looking at C89, C has 32 keywords, and Zig around 49 +/- 2 (not too sure). What that showed me, was that even with a lot of similarities, and the fact that I coded in Zig for 2 years, it was still difficult to get used to and learn C.

For me, one of the annoying parts was the fact, that I could never really remember what function or what struct is where. The fact that the FILE struct is located at stdio.h, while the DIR struct is in dirent.h, was something that bugged me for a while, but now after more than a month with C, is something I started to get along with.

Also, Makefiles are pretty darn cool. I have always been seeing them in big projects, and always wondered how they function. After coding a few projects and including a Makefile, I can safely say it is very nice seeing how your project is being made, after you type "make" and hit enter. The first time configuring the Makefile almost made me loose half my hair due to stress, but if you get it running properly once, then it is safe to say that it is gonna always run properly (especially for me, as my projects are somewhat small still).

What I came to appreciate more was the community in C. Thought I was gonna get insulted by some 59 year old grandpa, because I didn't make an out-of-bound check for my Pixels array, or because I didn't check whether or not the variable I de-noted with size_t exceeds __SIZE_MAX__ - 1. Kinda the opposite. I learned a lot by sharing my projects on Reddit, a lot of smart people were quick to point out mistakes, and tell me where I could improve or where I went wrong etc.

A lot of stuff, that I have learned, was because of people telling me. Adding -Wall -Werror warnings, -fsanitize=address,undefined, -fno-omit-frame-pointer, among other things are the sole reason I debugged and fixed my programs a lot quicker. Especially -fsanitize was important to me, as I always try to keep memory usage low for my programs, and activating that warning, showed me where my memory leaked, or where overflows happened (yeah... out-of-bounds checks are actually pretty useful...).

With that being said. I still have a lot to learn in C. I realized that my code is not really C-esque (as some might say), which is mostly because I come from (prior to Zig) high-level languages such as Python, JavaScript or even GoLang. Me handling arrays with indexes instead of using the given possibility of pointers, shows me, that I still have a long way to go.

But I am certain with one thing, that being that, C is way more different than I thought.

reddit.com
u/xerrs_ — 3 months ago

A month ago I was afraid of C. Now I am surprised with how far I have come.

About a month ago, I decided to learn C by building something Id actually use instead of writing small practice programs. That project became cherries(.)works Pulse, a lightweight process manager for Linux.

To be honest, I was pretty intimidated when I started. C has a reputation for being unforgiving, and even though I come from Zig, I had most of my experience with high-level languages, and well C... it felt like every mistake was mine to fix. There were definitely moments where I questioned whether Id picked a project that was far too ambitious (especially after the 6th segfault).

Then something happened that completely changed my mindset.

I shared an early version of Pulse and, to my surprise, it was reviewed by skeeto. I havent heard about skeeto, but after digging deeper to see who he was, I was very grateful for getting constructive feedback from someone who is a EXPERIENCED EXPERIENCED at what he does. That did give me a huge confidence boost ngl. Instead of feeling like I was stumbling around, I felt like I was actually learning the language the right way. That motivated me to keep improving the project instead of giving up when things got difficult.

Another thing that has genuinely surprised me is how welcoming the C community has been. I heard that the C community was harsh or elitist, but that hasnt been my experience at all. Whenever Ive asked questions or shared progress, people have been willing to explain concepts, point out mistakes, and suggest better approaches. The feedback has been direct, but it has been ALWAYS been constructive.

Today I finished Pulse v0.2.1 which adds:

  • Temperature monitoring
  • New info and top commands
  • stop help and monitor moved into their own dedicated commands
  • Better process detaching and quitting behavior
  • Internal cleanup and stricter validation throughout the codebase

Its still a small project, but Im proud of how far it has come in just a month. More importantly, it taught me a lot about processes, terminals, platform APIs, debugging, and writing software without relying on large frameworks.

https://github.com/cherries-works/pulse

Would love to hear what other experienced C programmers think about the code (i am trying to improve it actively), or developers monitoring, what else can I add?

Crazy, a month ago I had no idea how C works, now I want to keep coding in C.

reddit.com
u/xerrs_ — 3 months ago

Building a PNG decoder in C taught me way more than I expected.

Ive been learning C for a little under two months, and I wanted a project that would force me to understand binary formats instead of just using existing libraries.

So I started writing a PNG decoder from scratch.

Right now it parses the PNG structure, decompresses the image data, reconstructs the pixels, and writes the result as a PPM for verification. There are still bugs to fix and plenty of PNG features left to implement, but seeing an image appear from code you wrote yourself is incredibly incredibly satisfying. Especially after seeing countless Segfaults lmfao.

One interesting part is that I had previously implemented a lot of this in Zig, so translating the ideas to C was almost a 1:1 process. It made me appreciate how expressive C can be once you stop fighting the language and start understanding its model.

The decoder isn't the end goal, though.

Eventually I want PDC to use that image data as the first stage of a pipeline that generates 3D geometry from PNG images. Decoding the file format is just the foundation, and as crazy as it sounds the easiest part.

In the future, I hope I will be able to run PDC on my Raspberry Pi 4 B, which also includes the Camera Module! The PNG Decompression part was actually the easiest part, and took wayyy more energy than I anticipated at first (considering that I coded the same thing in Zig a while ago).

Would love to hear feedback on the code, and also on the README. I found some new cool README features, and thought that I should use them. Hopefully it is clean enough, so you guys get the idea.

https://github.com/mertishere/pdc

u/xerrs_ — 3 months ago

Kagi really worth it?

I am currently de-googling everything. I started with Kagi, and it was really great in my experience, however, now I am done with 100 searches, and I am currently thinking about purchasing the 10€ a month subscription.

Anyone knows if it is worth it?

reddit.com
u/xerrs_ — 4 months ago

Pulse, my very first C only project

I have been teaching myself systems programming over the past year by building software in C, and I just released the first public version of one of my projects: Pulse.

a lightweight Linux monitoring dashboard that:

  • reads system metrics directly /proc
  • serves a web interface using its own HTTP server
  • has minimal dependencies
  • is written entirely in C

The goal wasnt to build another Grafana replacement (cuz what the hell), but to create something small, understandable, and easy to run.

This is the first public release (v0.1.0), so Im mainly looking for feedback from people who use Linux or enjoy systems programming.

would love to know:

  • What would stop you from using it?
  • Is the codebase easy to navigate?
  • Are there metrics you'd expect to see?
  • Any obvious design mistakes?

Repository: https://github.com/cherries-works/pulse

I'm happy to answer questions about the implementation or discuss why I made certain design decisions. (I learned C less than a month ago, this is how I try to improve my knowledge, so be nice to me please lol)

u/xerrs_ — 4 months ago
▲ 41 r/Zig

I wrote a PNG decompressor and neural network from scratch for MNIST

A year back, I read a lot about people implementing a NN from "scratch", and then using PyTorch or other tools along the way. Wondered, what it would be actually like to implement it from sticks and stones (zig). Well, there goes my sanity lmao.

I have attempted this a while back, and finished the PNG decompression part almost a year ago, but the neural network never worked properly, which is why I abruptly quit the project for good. Came back two days ago; hours of debugging later, my neural network finally trains correctly on MNIST.

Very proud about the fact that I built the entire stack myself in Zig:

PNG Decompression, MNIST PNG parsing, matrix implementation, feedforward, backpropagation, gradient descent (with heavy inspiration AND help from sebastian lague).

No ML libraries, no NumPy, no PyTorch.

Math was annoying, but a lot of the stuff (such as partial deriviatives) were taught to me in school during the time, so that was alright. other issues, such as tiny implementation bugs like

- weights not actually updating

- wrong indexing dimensions

- hidden layer gradients using incorrect inputs

-sigmoid saturation from bad initialization

were a lot more annoying.

At one point the network would appear to learn smth depending on RNG seed, which turned out to be a mix of actual bugs + terrible weight initialization (mostly still dependent on luck cuz Xavier Init resulted in NaN output values...).

After fixing the training pipeline, it now reliably learns all digits 0-9 from MNIST.

Zig was probably the hardest possible language choice for this, but also the reason I understand it now.

The code is open-source over here;

https://github.com/XerWoho/Triarch

There are not any docs in docs/. My brain back then was solely focused on learning PNGs as it appears lol. I would suggest reading through the code, though it is really old (0.14.0), because it was a big learning journey for me, and could be for you to. Though this is what would basically happen if you would execute it;

https://preview.redd.it/a87eob7gir1h1.png?width=833&format=png&auto=webp&s=74147f5b6a35b307264290798bf329858168bbf0

(correct guesses / total attempts). (ignore the fact that the correct guesses are larger than total attempts... I wrote / 100 instead of / 1000... gotta stop using magic numbers)

Would love feedback, as this was total work of about 7-8 months (excluding the long break), though be nice to me, as the PNG decompression code (as mentioned), is almost older than me.

reddit.com
u/xerrs_ — 5 months ago

Everyone says 'track everything'. So founders end up with dashboards full of:

> 40 charts

> retention curves

> funnels they dont act on

And somehow… still no clue why users leave.

I hit that wall myself. I tried the usual stack; event tracking, page views, heatmaps. Looked impressive, felt productive… but it didnt answer the only thing that mattered:

"What is this user actually trying to do?"

Thats what im trying to solve with KiteFlow.

Instead of tracking anonymous noise, I focused on identified users + intent signals. So I dont get; "User clicked button X", but; "This specific user is trying to onboard, gets stuck here, and never comes back."

Kinda changed a lot; stopped optimizing for vanity metrics, started spotting real drop-offs tied to real people, literally follow a users journey and see where things break.

Trying to answer a different question entirely: "Why are users doing what they’re doing?"

Thats what I built KiteFlow around. Early insight I didnt expect:

Most of my visitors hit the landing page… click 'Get Started'… and disappear.

Classic funnel tools would show a drop-off. I see who did it, what they did before, and patterns between them.

I’m not pretending this replaces everything. If you need deep aggregate analytics, tools like GA/PostHog are still solid.

But if you're early-stage and still figuring out user behavior, I think most people are overcomplicating it.

Curious if anyone else ran into this? Or am I just reinventing something that already exists?

If you want to check it out;

https://kiteflow.dev

reddit.com
u/xerrs_ — 6 months ago

Everyone says 'track everything'.

So founders end up with dashboards full of:

> 40 charts

> retention curves

> funnels they dont act on

And somehow… still no clue why users leave.

I hit that wall myself. I tried the usual stack; event tracking, page views, heatmaps. Looked impressive, felt productive… but it didnt answer the only thing that mattered:

"What is this user actually trying to do?"

So I am trying something different.

Instead of tracking anonymous noise, I focused on identified users + intent signals. So I dont get; "User clicked button X", but; "This specific user is trying to onboard, gets stuck here, and never comes back."

Kinda changed a lot; stopped optimizing for vanity metrics, started spotting real drop-offs tied to real people, literally follow a users journey and see where things break.

Trying to answer a different question entirely: "Why are users doing what they’re doing?"

Early insight I didnt expect:

Most of my visitors hit the landing page… click 'Get Started'… and disappear.

Classic funnel tools would show a drop-off. I see who did it, what they did before, and patterns between them.

I’m not pretending this replaces everything. If you need deep aggregate analytics, tools like GA/PostHog are still solid.

But if you're early-stage and still figuring out user behavior, I think most people are overcomplicating it.

Curious if anyone else ran into this? Or am I just reinventing something that already exists?

reddit.com
u/xerrs_ — 6 months ago