• 1 Post
  • 9 Comments
Joined 5 days ago
cake
Cake day: August 18th, 2026

help-circle
  • I use Helix + Markdown + Zettelkasten + Git + Codeberg for notes. I just wrote a script whenever I type ns to the terminal I go to the Notes directory and it creates a process that git pulls in the background. I also add a half a second delay to opening Helix so HOPEFULLY by the time I write to the notes they are updated. As for backups, I was using Timeshift but it just uses too much space so I just got rid of it. I am just being careful when deleting files and directories.




  • Not a problem directly with the distro itself but; Void Linux. The community can be really hostile over small things, when you are following along the road they laid they are very friendly. However, as soon as you mention someone they dislike, criticize the distro and request for something that doesn’t align with them you get a lot of backlash. I remember asking them to create official Void Linux Discord server on Reddit because Reddit was the platform devs were using. I got attacked because apparently Matrix is FOSS and it was ridiculous for suggesting that bla bla bla. Another one was, I shared my Void Linux rice and it was nice at first then somebody noticed the based.cooking bookmark on my browser and then my post got deleted. I don’t even follow Luke Smith I just found the website on one of his videos while learning about Linux. Besides all that, there are very little packages and they intentionally won’t add some packages due to political reasons, why the fuck would I want your political stance to affect my experience. If I wanted oppression in my OS I would rather use Windows or Mac, at least I would have more programs there. Sorry for the wall of text, just puking fair dislike ^^


  • You can try this I kinda half-arsed it though. I personally could not see the issue in your code other than the fact that you are writing bad/ugly code. I don’t mean it in a rude way, you should read other people’s code and understand the conventions. Besides that, I think the issue is with the delays.

    // This is a lot more understandable now
    #define ENTRY_FINISH_PIN 8
    #define ENTRY_NUMBER_PIN 9
    #define ENTRY_REPORT_PIN 13
    
    #define ENTRY_DELAY_MS 500
    #define ENTRY_REPORT_SHOW_MS 500
    #define ENTRY_REPORT_WAIT_MS 100
    
    int GetNumber()
    {
        // loop until ENTRY_FINISH_PIN is HIGH
        // if ENTRY_NUMBER_PIN is HIGH, add to the iterant and turn on the LED
        // after that wait a bit and turn off LED
        
        int iterant = 0;
        while (digitalRead(ENTRY_FINISH_PIN) != HIGH) {
            if (digitalRead(ENTRY_NUMBER_PIN == HIGH)) {
                iterant++;
    
                digitalWrite(ENTRY_REPORT_PIN, HIGH);
            }
    
            delay(ENTRY_DELAY_MS);
            digitalWrite(ENTRY_REPORT_PIN, LOW);
        }
        
        return iterant;
    }
    
    void setup()
    {
        pinMode(ENTRY_FINISH_PIN, INPUT);
        pinMode(ENTRY_NUMBER_PIN, INPUT);
        pinMode(ENTRY_REPORT_PIN, OUTPUT);
    }
    
    void loop()
    {
        int sum = GetNumber() + GetNumber();
    
        for (int i = 0; i < sum; i++) {
            digitalWrite(ENTRY_REPORT_PIN, HIGH);
            delay(ENTRY_REPORT_SHOW_MS);
            digitalWrite(ENTRY_REPORT_PIN, LOW);
            delay(ENTRY_REPORT_WAIT_MS); // waiting a bit more makes sense imo
        }
    }
    

    I wish u luck with your Arduino adventure ^^




  • TBF it is not complicated but it does use the simplest form of pointer arithmetic and order of operation of (++var) or (*var++). Considering OP couldn’t write a basic version of this I did not want to put pressure on him. If you can understand it as a beginner good for you! You must remember that a lot of developers struggle to learn pointers in the first place for some reason. I blame AI.

    EDIT: Also I did not say this is advanced, just not beginner friendly



  • It is not beginner friendly but it is optimized. It doesn’t allocate memory or whatever. I don’t expect you to understand all this but I did it for fun anyway.

    int print_file(const char* buffer)
    {
        // Validate the buffer
        if (!buffer || *buffer == '\0') return 1;
    
        // Prepare the first line prefix
        unsigned int line = 1;
        printf("%4d\t", line); // You could pre-format it if u want
    
        const char* cursor = buffer; // The pointer that points to the first char
        const char* linestart = cursor; // The start of the line
        char ch; // Character register
    
        while (true) {
            ch = *cursor++; // Read character THEN advance the cursor.
    
            // Check if the character is null or is newline or windows thing
    
            if (ch == '\0') {
                int linelength = cursor - linestart - 1; // Minus the null terminator
                printf("%.*s\n", linelength, linestart); // Print line using the length of string
                break;
            } else if (ch == '\n') {
                int linelength = cursor - linestart - 1; // Minus the newline
                printf("%.*s\n", linelength, linestart); // Print line using the length of string
                linestart = cursor;
    
                printf("%4d\t", ++line); // Print next line prefix
            } else if (ch == '\r') {
                continue; // Ignore the Windows thing
            }
        }
        
        return 0;
    }