• 0 Posts
  • 10 Comments
Joined 9 months ago
cake
Cake day: March 1st, 2026

help-circle
  • I (not EU) self host my email on a vultr VPS. I use the classic dovecot + postfix setup, IMAP for clients, spamd (spamassassin) for extra filtering, etc., etc… I’ve got SPF+DKIM+DMARC, a couple different domains, the whole nine yards, just for hobbying that’s grown over the years for family members.

    All that said, unless you’re pretty dang familiar with all those things, I personally would agree with the several people who have just pointed to smaller-time email providers that support custom domain names. It gives you the control to pull it back to your own server later if you want to take on that endeavor (via simply DNS updates), but means you don’t have to worry about the complex bits now. I would definitely not recommend hosting it in your own home - not because of availability issues or anything like that (as others mentioned, legitimate email providers retry by policy, so you don’t need quad-nine uptime), but because most residential IPs, at least by default, are going to get blocked by most providers for being on a common policy blocklist - that is, your ISP likely tells e.g. spamhaus that your IP is residential and shouldn’t be sending email. If you have a business internet plan, that changes. And I could also be wrong for UK; I’ve just got US knowledge on that particular bit.

    If you’re familiar with all the bits of SPF, DKIM, and DMARC and want to go for it, a VPS would be my recommendation. Note: many block outbound to port 25 by default to prevent spam bots abusing their IPs, so you’ll need to keep that in consideration. Otherwise, one of the email providers mentioned is probably a good bet.


  • Most of the stocks in an IPO are purchased by investment firms or large corporations - so it’s extremely uncommon to have no willing buyers.

    The IPO price usually also allows for a pretty decent discount on the projected valuation. So, those big investors are looking to get in early and get as cheap as they can. So for something like this, there will be buyers.

    That said, entertaining the hypothetical where no one buys: the IPO is likely canceled, in the most hilarious embarrassment in a good while on the market. If just a fraction of the expected shares were sold, they may be subject to a mandatory refund. Then the company can regroup and try again later, or just take the embarrassment and go.


  • S&P500 lifetime inflation-adjusted return is 7-8%. meaning, if one put away 150K in the S&P500 at age 20 and worked for 40 years, putting away nothing else but gaining that inflation-adjusted 7-8 (conservatively call it 7), and then pulled out a measly 4%, allowing the remaining growth to account for inflation, they’d be pulling an inflation-adjusted income of >80K, ignoring any other income.

    I’m not saying one shouldn’t put anything else away or strictly count on matching historical S&P return, but yes, putting away 150K at 20 could absolutely mean you don’t need to put anything away again.


  • So there’s a couple errors I can see in there: one which causes your issue here, and one that will cause another painful issue, unless you’re lucky.

    1. malloc(strlen(buffer + 1)); is not the same as malloc(strlen(buffer) + 1);. Your allocation is actually one byte shorter than your input string. This means your strcpy will copy a byte past the allocated buffer. Only bad things can come out of that, and they may not be noticeable at first.
    2. The issue you’re actually describing here requires maybe a bit better of an understanding of pointers. malloc is giving you back an address - call it 0x0001 - and promises to have at least the available size you requested. You promise to at some point free that address. That address is stored into line. strchr returns a different address - one later in the string, specifically. Your loop continuously advances line to that new address plus one. So, at the end, you’ve been given an address, 0x0001, and you’re trying to free some other address - e.g. 0x10de. That’s why you can’t free; you’re freeing something other than what you malloc’d. You need to hold onto the actual address returned by malloc in another variable, and free that address specifically.

    For #1, I’d personally recommend taking a look at strdup instead of malloc + strcpy. It’s identical functionally, so I invite you to wholly understand all three functions and understand when/why they’re used, but when copying a string exactly, strdup is the way to go - and it removes the possibility of an errant + 1. As part of the understanding, understand that the result of strdup does still need to be given to free eventually.

    As a general note, to provide maybe some clarity on “is it fine to not free strings” - strings don’t really exist in C. That is, there’s not some special thing that the system sees as a string. They’re by convention - a string is a blob of non-'\0' bytes that ends with '\0'. malloc and free do not know or care what you did with the bytes you received, and whenever you see a man page say that it does something with a string (copy, search, etc.), you can confidently substitute string with “blob of non-nul bytes ending with a nul byte”. “string” just sounds nicer, and by convention, that’s what we know a “C string” to be.


  • Most linux distributions either include C man pages by default or add them in when you install dev tools. I’d be surprised if man strchr didn’t already come up with something for you.

    If you’re going down this path, it’s worth recognizing the different meanings of the man sections - shell commands in section 1 means that e.g. man chown is going to show you shell instead of the C function you’ll see from man 2 chown. In the same vein, section 3 has library functions, which are sometimes more relevant for you than section 2’s syscalls.



  • the strtok issue is, per the man page, that strtok returns only “non empty” tokens with your given delimiters.

    Given only one delimiter, the strchr approach is likely what I’d use. understanding strchr (and the similar strstr) is a pretty useful thing to have anyway, so it’s a good time to learn it. strchr makes no modifications and isn’t aiming to make tokens for you. It is looking for the first instance of a given byte in a C string and, provided it found it, returning you a pointer to that byte. as such, if it returns you something other than NULL, you’ve got a pointer to a byte. assuming you’re fine with the function modifying the buffer, you can convert that byte to a nul byte (\0), then print buffer, then a new line. You then advance your buffer pointer to the byte past the now-nul byte. Continue until strchr returns NULL, which is your last line - assuming the buffer is nul-terminated

    Edit: example, now that I’ve got a real keyboard:

    void strchr_loop(char *buf) {
        char* p;
        while ((p = strchr(buf, '\n')) != NULL) {
            *p = '\0';
            printf("Line = %s\n", buf);
            buf = p + 1;
        }
        printf("Last line = %s\n", buf);
    }
    


  • My ISP charges a good chunk for static IP (because they consider it a business connection). However, my $10/mo VPS (which I already had for other projects) has its own static IP and I can easily proxy individual requests through it as needed. Have looked at VPS instances for $5/months before.

    Depending on the service, your ISP, and how easily you can change IPs in the registration, as others have mentioned, you could just give them your public. I’ll say my own public does change at least twice a month, so if I can’t automate updating a registration, it goes through VPS or it’s a service I just skip.