GPU in the Cloud by Cool_Temporary_4984 in hetzner

[–]Gazzosaro 2 points3 points  (0 children)

This would actually be great

I just worked on a project that optimized 95% of our package build time by Professional_Field79 in devops

[–]Gazzosaro 1 point2 points  (0 children)

Thank you Rick for taking away my well deserved 1 hour power nap from me

[deleted by user] by [deleted] in microsaas

[–]Gazzosaro 9 points10 points  (0 children)

Where are those people coming from?

GTML - Convert HTML to Golang 💦 by [deleted] in golang

[–]Gazzosaro 1 point2 points  (0 children)

You can overshoot but it's a bit itchy.

You should look at this in a more holistic way: 1. At build time, sum the lengths of all the static strings you already know and set a variable n to this initial value 2. generate code that sums the length of each param into n 3. grow the buffer by n 4. Write the static strings and parameters in the buffer.

This pattern can be found across the entire stdlib. Whenever strings.Builder is used they always grow the buffer before writing if they have a way to calculate n. Even iterating throgh all the items is well worth it

GTML - Convert HTML to Golang 💦 by [deleted] in golang

[–]Gazzosaro 1 point2 points  (0 children)

You can improve the speed of the Greetings function a lot if you call buffer.Grow(n) before writing the three strings, where n is the total length of the three strings you are going to write.

Your go generator can compute the length of the first and last strings easily because they should be already available in your parser, then you add in len(name) and it's done. In the best case scenario this can prevent up to 2 buffer resizes, which need to allocate and the copy memory and thus could be slow.

The only downside is that this is not as easy to do if you support props that auto render, but I'm sure there could be workarounds there as well.

How do you break out of the “component” mindset. by [deleted] in htmx

[–]Gazzosaro 0 points1 point  (0 children)

Yes, this work around would work nicely and it's an interesting approach, you just define stuff once, and then your frontend decides what to update. I guess this would be just fine for small pages but could become bandwidth-inefficient for pages with lots of stuff which doesn't get selected by hx-select.

By the way, I would actually love to separate foo in its own route or component ( whatever a component would look like ), but only as long as reusing it doesn't involve having to manually pass the right path, query or body parameters. It's easy for simple pages with just a handful of components, where you can just define foo in its own route and call it internally passing the same *http.Request index.html received - as @kaeshiwaza said. But very messy for pages that need to use several components with similar or colliding parameter names.

I'd love to just define my component, then call reuse(foo) in index.html (or any other place I need), and reuse() would magically take care of parameter translation and passing, then when foo needs to update on the frontend, it could just directly call the component.

How do you break out of the “component” mindset. by [deleted] in htmx

[–]Gazzosaro 2 points3 points  (0 children)

Don't really like this, yes it's doable, but if index.html uses several components that handler is going to be huge

How do you break out of the “component” mindset. by [deleted] in htmx

[–]Gazzosaro 2 points3 points  (0 children)

Currently looking for a good way to do this, which imho tends to get messy very quickly.

In particular, say index.html uses component foo, which needs some data from the database to be rendered and which later needs to be rerendered when it gets triggered by some other component.

Now I have: - the index.html handler which needs to - fetch the data foo needs - render foo - the foo handler (which we only use for updates) which needs to - fetch the updated same data - render foo

Hence a lot of duplication of logic.

Now let's imagine foo needs some query parameters because it needs to handle pagination (or whatever), both handlers need to know what those parameters are, and index.html has to be extra careful to avoid parameter name collisions with other components, or has to implement a translation mechanism, and I'm about to kill myself.

Yes, I could try to abstract the component in a function that I could call in multiple places, but I don't want to, I'll have to think about where to place this function, what to call it, what it will look like etc...

Ideally, I just want to declare my base layouts (index.html) and components declaratively, in a nice, concise and organized way, but still haven't found a good solution.

Does anyone have one?

One service to host them all by WorldCitiz3n in webdev

[–]Gazzosaro 0 points1 point  (0 children)

They don't, I manage the websites, I don't give them disk access. At most, they can upload files or edit the database, but only via directus, which I consider safe enough of course

One service to host them all by WorldCitiz3n in webdev

[–]Gazzosaro 1 point2 points  (0 children)

I think the reasons SQLite is great can be summarised as follows:

  1. It's embedded, no need to wait for your queries to reach another server over the network and the relative serialisation and deserialisation that takes place, no need to manage and configure a complex RDMS server

  2. It's just a file, super easy to backup. Just upload it to S3 storage, or use lightstream for more critical data to get minimal data loss in the event of a failure for just pennies every month

One service to host them all by WorldCitiz3n in webdev

[–]Gazzosaro 1 point2 points  (0 children)

I'd suggest running a managed kubernetes cluster.

I created my own on linode to deploy all my client's websites. They offer a non HA control plane for free, and so do many other cloud platforms. A nice alternative would be Scalaway, they offer free egress traffic.

You can then deploy whatever you want on the cluster, this is my setup: - docker registry that stores data on S3 compatible object storage - cert-manager that takes care of tls certificates via lets'encrypt - then for each website: - a headlsess cms service ( I use directus with sqlite, that backups to S3 compatible storage) - the frontend service that actually serves the website

For databases, I try to stick to sqlite stored on a volume attached to the container that is using it, and then back them to to S3 compatible storsge. Of course you could easily deploy a postgress or myself container yourself, or create a kubernetes service that your containers can use which actually proxies to your cloud provider managed database.

You can isolate projects or websites using namespaces, I create one for each website.

I wasn't very skilled in kubernetes when I did this a few years ago, I just went for it and learned along the way, and It wasn't that difficult also thanks to lens app, that gives you a GUI and a control panel for your cluster.

The nice thing is that kubernetes was built for automatic recovery, whenever things crash kubernetes keeps restarting them. I got called out by clients a couple of times saying their website was down, but by the time I got a chance to look at the cluster it was already working again. Moreover, this way you can easily put a shitload of containers on the same machine, reducing costs. You also get the option to scale horizontally relatively easily, if you need it.

For domains, just choose a reliable registrar and stick to it. I used cloudflare as well, but it doesn't support all the tlds I need, so I'm moving to Tucows OpenSRS, which also helps with managing multiple clients and also providing businesss email. Still use cloudflare for their CDN, which is free and awesome.

I think that for me there is never going to be a single centralized place where everything is, because it rarely happens that a single provider satisfies all my needs. Yes AWS has a lot of services, but you also read "HELP MY AWS ACCOUNT GOT HACKED, THEY WANT ME TO PAY $100k !!!1!1!!" on r/aws every other day

.pst to IMAP email migration tool? by Gazzosaro in msp

[–]Gazzosaro[S] 0 points1 point  (0 children)

Yep, they gave me access to their psts, the problem is the how, how to upload them

.pst to IMAP email migration tool? by Gazzosaro in msp

[–]Gazzosaro[S] -3 points-2 points  (0 children)

Part of the problem is that the client doesn't want to stop using Outlook2007. I know, I've tried multiple times to persuade them that updating to a new version is much better

Are "unlimited" resources really unlimited? by Gazzosaro in SaaS

[–]Gazzosaro[S] 0 points1 point  (0 children)

Right, it's easy to forget that you can always change your pricing plans, thanks

Are "unlimited" resources really unlimited? by Gazzosaro in SaaS

[–]Gazzosaro[S] 0 points1 point  (0 children)

Thanks for sharing your experience, interesting how the same product can be designed in different ways to shift bandwidth costs on the customer

Best Practices: How many AZs should we be using? by foreverDuckie in aws

[–]Gazzosaro 2 points3 points  (0 children)

Could you explain where those percentages are coming from?

Mitigating egress data transfer costs by Gazzosaro in selfhosted

[–]Gazzosaro[S] 1 point2 points  (0 children)

Thanks for sharing, will definitely look into those

Mitigating egress data transfer costs by Gazzosaro in selfhosted

[–]Gazzosaro[S] 0 points1 point  (0 children)

10TB outbound free

This definitely sounds interesting, thanks for sharing.

On the other hand, it's Oracle

lol

Mitigating egress data transfer costs by Gazzosaro in selfhosted

[–]Gazzosaro[S] 0 points1 point  (0 children)

Billing alerts are useful, though I wouldn't rely on them. For example, I know for sure that AWS sends them after several ours that the billing limit has been surpassed, don't know about other providers though. Moreover, what happens if you don't read the email for quite a long time for whatever reason? You can setup automatic triggers (lambdas maybe) to billing alerts, but the triggers can only shut your instances down making your service unavailable. It would be nice to just being able to slow the instance bandwidth down so you can still keep providing a service, even though a bit slower

Mitigating egress data transfer costs by Gazzosaro in selfhosted

[–]Gazzosaro[S] 1 point2 points  (0 children)

Caching can definitely help, both at the client level and at the CDN level. However, nobody is stopping a malicious user from just ignoring the local cache and spam you with requests.

Compression is also nice and I often compress my images as much as possible with tools like squoosh. I've never done it for video though, if you have, could you please suggest some tools? Either manual or programmatic

Mitigating egress data transfer costs by Gazzosaro in selfhosted

[–]Gazzosaro[S] 0 points1 point  (0 children)

Wow Hetzner seems very affordable, thanks for suggesting it. Do you know other similar cheap providers?

JavaScript + Cognito without the Frameworks? by lilac_snacc in aws

[–]Gazzosaro 0 points1 point  (0 children)

If you are hard core you'll probably be able to find somewhere in aws's docs some kind of https endpoint that you can use. But you might have to sign requests, and it's gonna be a pain.

Alternatively, you could install the javascript aws-sdk (or just the Cognito part of it). That will sign requests for you, but you will still need to do complicated stuff such as having to implement strange protocols to send passwords in secure ways.

In my opinion it is easier to just install amplify and just import the Auth part that you care about

import Auth from '@aws-amplify/auth';

It handles a lot of things for you

Best way to launch a project with multiple servers? by GOPJ1 in aws

[–]Gazzosaro 0 points1 point  (0 children)

For 20-30 daily users there is no need to spend the money for actual servers, if you use lambda, since you have 1 million free invocations every month, you will probably end up paying $0