levant's cyberspace

/journal.html

MENU

『 journal 』


june 15th, 2023


hey, did you know my psoas hates me?

it's so tight it's like having a little knot lodged right in your hip. i have tried everything: from stretching to all hell to actual voodoo magic.

this muscle is so tight it puts a vacuum sealed package to shame.

anyone up for a tight psoas pity party?


march 5th, 2023


here is a c++ program that converts webp to png, because why not, can be useful

you'll need libpng and libwebp

#include <iostream>
#include <webp/decode.h>
#include <png.h>
#include <cstdio>

int main(int argc, char* argv[]) {
    if (argc != 3) {
        std::cerr << "Usage: webp2png input.webp output.png\n";
        return 1;
    }

    // Load the input .webp image
    const char* input_filename = argv[1];
    int width, height;
    uint8_t* webp_data = NULL;

    {
        FILE* file = fopen(input_filename, "rb");
        if (file == NULL) {
            std::cerr << "Failed to open input file: " << input_filename << "\n";
            return 1;
        }

        fseek(file, 0, SEEK_END);
        size_t file_size = ftell(file);
        fseek(file, 0, SEEK_SET);
        webp_data = new uint8_t[file_size];
        fread(webp_data, 1, file_size, file);
        fclose(file);

        if (!WebPGetInfo(webp_data, file_size, &width, &height)) {
            std::cerr << "Failed to get WebP image info\n";
            delete[] webp_data;
            return 1;
        }
    }

    // Decode the .webp image into RGBA pixels
    uint8_t* rgba_data = new uint8_t[width * height * 4];
    if (!WebPDecodeRGBA(webp_data, strlen((const char*)webp_data), rgba_data, width, height)) {
        std::cerr << "Failed to decode WebP image\n";
        delete[] webp_data;
        delete[] rgba_data;
        return 1;
    }
    delete[] webp_data;

    // Create a new PNG file and write the decoded pixels to it
    const char* output_filename = argv[2];
    FILE* file = fopen(output_filename, "wb");
    if (file == NULL) {
        std::cerr << "Failed to open output file: " << output_filename << "\n";
        delete[] rgba_data;
        return 1;
    }

    png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
    if (png_ptr == NULL) {
        std::cerr << "Failed to create PNG write struct\n";
        fclose(file);
        delete[] rgba_data;
        return 1;
    }

    png_infop info_ptr = png_create_info_struct(png_ptr);
    if (info_ptr == NULL) {
        std::cerr << "Failed to create PNG info struct\n";
        png_destroy_write_struct(&png_ptr, NULL);
        fclose(file);
        delete[] rgba_data;
        return 1;
    }

    if (setjmp(png_jmpbuf(png_ptr))) {
        std::cerr << "Failed to write PNG image\n";
        png_destroy_write_struct(&png_ptr, &info_ptr);
        fclose(file);
        delete[] rgba_data;
        return 1;
    }

    png_init_io(png_ptr, file);

    png_set_IHDR(png_ptr, info_ptr, width, height, 8, PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);

    png_write_info(png_ptr, info_ptr);

    for (int y = 0; y < height; y++) {
        png_write_row(png_ptr, rgba_data + y * width * 4);
    }

    png_write_end(png_ptr, info_ptr);

    // Clean up
    png_destroy_write_struct(&png_ptr, &info_ptr);
    fclose(file);
    delete[] rgba_data;

    std::cout << "Successfully converted " << input_filename << " to " << output_filename << "\n";
    return 0;
}
        

august 29th, 2022


lately i've started doing some ultrakill speedruns and i decided to submit one to speedrun.com for the level 2-1.

i'm in 75th place but look at me go!!!!!!!!


august 28th, 2022


there are times in my life when i start dreaming a lot more than usual, most of those dreams being quite vivid.

they range from being harmless, such as me walking around a busy road to being some very fucked up nightmares.

this night, however, the dream i had was quite confusing.

for some reason i broke into somebody's house and was contemplating whether to steal stuff from them or not.

i decided to grab a laptop from them but then as soon as i left i felt bad and returned it.

i tried to leave the house using the door but i broke the doorknob.

i woke up very confused.


august 27th, 2022


dark web browsing is a lot of fun, you can always stumble upon weird stuff.

don't let this scare you away from it though! read my blog post regarding the dark web!