Interests: programming, video games, anime, music composition

I used to be on kbin as e0qdk@kbin.social before it broke down.

  • 2 Posts
  • 52 Comments
Joined 2 years ago
cake
Cake day: November 27th, 2023

help-circle
  • I’m not sure how to do what you want with customizing Mint directly, but a possibly simpler alternative solution is to just send two clearly distinguishable USB drives (e.g. label them “1” and “2” with a label maker or get two drives with very different colors) and tell him to install (unmodified) Mint from the first and then have him run a program you provide on the second after that’s done to make the other changes.







  • the thumbnails now are even more clearly 4-pixel potatoes

    pictrs’s thumbnail parameter uses dumb raw pixel sampling – which leaves something to be desired… It has other sampling options implemented (with resize, according to the docs), but they don’t seem to accessible on my instance. You can remove thumbnail=96 if you want to get the image without that thumbnail sampling, at least.

    make everything zoom 150%

    I do this with my browser’s UI (ctrl-plus keyboard shortcut in FF-based browsers works for me).

    e.g. right side bar

    [...document.querySelectorAll(".side")].forEach(sidebar => sidebar.remove())

    You could also just adblock the element with class side.



  • Voting

    You could support this by making vote buttons submit a form if JS isn’t enabled. (That’s what mlmym does.)

    Can’t manually switch between dark and light mode

    Hmm… There are some pretty nifty things you can do with a hidden checkbox, label, and some clever CSS (e.g. html:has(#element:checked) + CSS variables – though FYI :has is baseline 2023.)

    Making it persistent would require some more effort – e.g. form + cookies + server side style sheet selection, most likely. mlmym lets users change their theme w/o JS by submiting a form on the setting page. I’d have to think a bit if there’s a good way to make it persistent across multiple requests for logged out users with a CDN caching things in between though…

    only automatically based on browser settings

    Doesn’t actually work for me in a FF138-based browser w/ JS blocked via NoScript – I always get light mode despite having a dark mode preference set. (Where do you have your prefers-color-scheme media query?)

    Also, FYI I had to manually override font restriction – otherwise all your buttons end up as tofu characters. (I think NoScript is being kind of unreasonably strict there by blocking first party fonts.) That’s a papercut kind of issue, but figured I’d point it out in case it might save you some debugging time if you get confused NoScript users in the future.






  • Try adding some prints to stderr through my earlier test program then and see if you can find where it stops giving you output. Does output work before curl_easy_init? After it? Somewhere later on?

    Note that I did update the program to add the line with CURLOPT_ERRORBUFFER – that’s not strictly needed, but might provide more debug info if something goes wrong later in the program. (Forgot to add the setup line initially despite writing the rest of it… 🤦‍♂️️)

    You could also try adding curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); to get it to explain more details about what it’s doing internally if you can get it to print output at all.



  • As a sanity check, does this work?

    #include <curl/curl.h>
    #include <stdio.h>
    #include <stdlib.h>
    
    size_t save_to_disk(char* ptr, size_t size, size_t nmemb, void* user_data)
    {
        /* according to curl's docs size is always 1 */
        
        FILE* fp = (FILE*)user_data;
        fprintf(stderr, "got %lu bytes\n", nmemb);
        return fwrite(ptr, size, nmemb, fp);
    }
    
    int main(int argc, char* argv[])
    {
        char errbuf[CURL_ERROR_SIZE];
        FILE* fp = NULL;
        CURLcode res;
        
        CURL* curl = curl_easy_init();
        
        if(!curl)
        {
            fprintf(stderr, "Failed to initialize curl\n");
            return EXIT_FAILURE;
        }
        
        fp = fopen("output.data", "wb");
        if(!fp)
        {
            fprintf(stderr, "Failed to open file for writing!");
            return EXIT_FAILURE;
        }
        
        curl_easy_setopt(curl, CURLOPT_URL, "https://www.wikipedia.org/");
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, save_to_disk);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
        curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
        
        errbuf[0] = 0;  /* set error buffer to empty string */
        res = curl_easy_perform(curl);
        
        if(fp)
        {
            fclose(fp);
            fp = NULL;
        }
        
        if(res != CURLE_OK)
        {
            fprintf(stderr, "error code   : %d\n", res);
            fprintf(stderr, "error buffer : %s\n", errbuf);
            fprintf(stderr, "easy_strerror: %s\n", curl_easy_strerror(res));
            
            return EXIT_FAILURE;
        }
        else
        {
            fprintf(stderr, "\nDone\n");
            return EXIT_SUCCESS;
        }
    }
    

    That should write a file called output.data with the HTML from https://www.wikipedia.org/ and print out the number of bytes each time the write callback receives data for processing.

    On my machine, it prints the following when it works successfully (byte counts may vary for you):

    got 13716 bytes
    got 16320 bytes
    got 2732 bytes
    got 16320 bytes
    got 16320 bytes
    got 128 bytes
    got 16320 bytes
    got 16320 bytes
    got 1822 bytes
    
    Done
    

    If I change the URL to nonsense instead to make it fail, it prints text like this on my system:

    error code   : 6
    error buffer : Could not resolve host: nonsense
    easy_strerror: Couldn't resolve host name
    

    Edit: corrected missing line in source (i.e. added line with CURLOPT_ERRORBUFFER which is needed to get extra info in the error buffer on failure, of course)

    Edit 2: tweaks to wording to try to be more clear



  • Magnitude 6.7 earthquake. Woke up to it shaking my bed violently in my dorm room. (Boarding school) Thankfully, I didn’t have anything above me that could fall, but some of the other students kept books in the shelves above their beds. Suffice it to say they got an even ruder awakening than I did…

    There was a big aftershock a few minutes later – just after I’d gotten the hell out of the building, basically – and smaller aftershocks for days afterwards.

    It put a big crack in the floor of my dorm and everyone who lived there had to stay outside all day until the administration declared it safe for us to re-enter.

    That was coincidentally the same day as a school festival and I’d spent the evening before working with my classmates converting the art room into a haunted house. I never got to see the mess, but whatever happened in there was so bad the room was unusable for months. Most of the rest of the festival (e.g. outdoor stalls and such) was still able to be run though, so they carried on with the parts they could. It was surreal.