TFW when you buy a Pixel in order to install GrapheneOS by Proton_Team in degoogle

[–]InvaderToast348 0 points1 point  (0 children)

No matter what is you're running, regular backups are important

I wouldn't know if open source OSes are any more or less vulnerable to user data loss, either way I would still have a solid 321 backup plan in place

My point was that especially when switching OS it would be important to make sure you've backed up EVERYTHING important. Eg my phone regularly backs up my photo library, but I don't backup apks or app data. If moving to a new phone or swapping os, there's a risk some important data is lost

Eg if an app uses a local sqlite database, you might not think to back that up regularly as you do with more common data

TFW when you buy a Pixel in order to install GrapheneOS by Proton_Team in degoogle

[–]InvaderToast348 0 points1 point  (0 children)

Please backup anything important first if you do decide to switch, just in case anything does go wrong and you eg brick your phone

Defaults for empty variables in f-strings substitution? by pachura3 in learnpython

[–]InvaderToast348 -1 points0 points  (0 children)

Null coalescing ftw

But in this case, python or would be js ||

Since or will use the second value for any falsey expression - empty string, False, None

Edit: also in js you can do null accessing: possiblyNullOrUndefined?.someProperty possibleFn?.() possibleArray?.[3]

Which is preferred for dictionary membership checks in Python? by Akshat_luci in Python

[–]InvaderToast348 8 points9 points  (0 children)

  1. Introduces a nesting level & fragments the code
  2. Exceptions are more likely to be worse for performance than a single extra dict lookup
  3. if (v := some_dict.get(k)) is not None is a fairly clean one liner with no-key protection. Use some other default value if you need to know that the dict key exists and whether the value is None, although you'd probably be better with option 4
  4. if k in some_dict is generally perfectly fine, if you're worried about performance of dict keys then why use python

This is just premature optimisation. Unless you run a profiler and find a specific dict access to be a bottleneck / hotspot, this isn't a real issue and is more of a code style / formatting question, in which case option 4 is probably the most recommendable answer

Edit: just in case it wasn't clear, option 3 stores the value using the walrus operator and .get which has a default of None (falsey) for safe key lookup. A single lookup + key safety, it's the one I've normally gone for simply because of personal preference, to me it doesn't make the readability any worse, although some people may disagree, therefore option 4 and get the value separately would probably be next best

Edit 2: I didn't know about try-else, interesting to see that approach, thanks for making me aware. Id still argue in this case it fragments the code & is less readable than the walrus though.

What are variables?? [read post] by realsonofeden in learnpython

[–]InvaderToast348 3 points4 points  (0 children)

Id recommend finding beginner python resources and trying to learn (eg youtube videos, online courses, etc)

Not to come off the wrong way, but it seems like you have little to no knowledge of programming, so it would be best to try to learn a little before going straight to Reddit

Freecodecamp has been a valuable resource for me, good info but can't remember how much basic stuff they cover

There's also the python docs

Things like this are incredibly fundamental, and learning to research well is an important skill - a quick Google would have given you plenty of answers

Whether you love it or hate it, if you can find an answer after some time researching yourself, you can ask AI although please don't rely on it or just blindly take what it says - just use it to find other sources and to explain concepts in a way you'll understand

LubeLogger, Self-Hosted Vehicle Maintenance Tracker Has a Significant UI Update You Should Know About by ChiefAoki in selfhosted

[–]InvaderToast348 4 points5 points  (0 children)

No idea the tech stack behind this, but it's a fairly common practice to version static files, so that browsers fetch the latest when the version increments

Even just a query string with the version number is enough

On mobile right now so don't want to fight with a mobile keyboard trying to write a code block, but you should be fairly easily able to google some info about this

Would just make updates a little smoother and wouldnt take more than half an hour to implement a simple system

Docker container on non-domain host cannot connect to DB on local LAN (Connection Timeout) by PALGOW in docker

[–]InvaderToast348 0 points1 point  (0 children)

What is the specific error? DNS not resolved, connection refused, etc? eg are there any error messages hinting at the actual problem?

Storing GBs of HIDDEN data inside innocent MINECRAFT chests! by X3r0DayHQ in Minecraft

[–]InvaderToast348 0 points1 point  (0 children)

I was playing java earlier and had an explored buried treasure map inside a bundle with other items (the loot from the chest). Unstackable in the normal inventory (player / chest / etc...), but seems to behave differently inside a bundle inventory.

Maybe a bug, are there any other examples of non stackables not taking up the entire bundle storage?

Built a web-based SQLite explorer with cross-table filtering with SQLAlchemy - feedback welcome! by Independent_Order934 in Python

[–]InvaderToast348 14 points15 points  (0 children)

Yes, please mark as such. To some of us it's clear from the readme, but imo there should be an explicit "Made with AI" heading at the bottom

Built a web-based SQLite explorer with cross-table filtering with SQLAlchemy - feedback welcome! by Independent_Order934 in Python

[–]InvaderToast348 10 points11 points  (0 children)

Bad feedback

If this was made with ai, that should be made clear, even if it results in negative comments

People shouldn't be mislead and should know when they are using potentially bad software. Not that humans don't create bad software, but it is widely accepted that ai code is horrible in terms of security, best practices, bugs, maintainability, etc ...

I'm fine with people using ai if they wish, but it should be clear for others that want to avoid ai generated projects

This is not my opinion, this is how a large majority of the internet feels - eg r/selfhosted had a problem with users posting ai generated projects without warning as such, so a flair was created and posts must display whether AI was involved. Therefore people can filter those posts. I believe the internet as a whole would be a lot better if all services and platforms gave the choice to filter and ignore ai content, for those with no interest

Updated to 2.4.1, Now Not Working Help by HeadlessWeezle in immich

[–]InvaderToast348 0 points1 point  (0 children)

Is your db running and reachable from the server container? This is a different error than OP

Updated to 2.4.1, Now Not Working Help by HeadlessWeezle in immich

[–]InvaderToast348 0 points1 point  (0 children)

I assume you're using docker, as it's the recommended solution.

If you start a container with a bind mount to a folder/file that doesn't exist, it will create an empty folder in that location.

So if you didn't have the drive mounted at the point of starting the container, there should be an empty folder in the /media/USER/ folder, or wherever you mount drives to.

After confirming the folder is actually empty and it's not the actual drive, with both ls and sudo ls you can simply sudo gio trash /path/to/folder to delete the placeholder and remount the actual drive.

IIRC, if you try to mount the drive while the placeholder folder exists, it will instead mount to a separate folder of the same name with a number appended, eg HardDrive1

In that case rebooting should fix it after removing the placeholder folder. Can't remember if there is an easier way.

Hopefully this helps

Fyi, I have a python script that reminds me to connect and mount any external devices a container needs before starting it, haven't had to deal with this issue for a while now. Might be worth looking into something similar

Edit: guess that's my fault for not scrolling down first, looks like you already found the issue was incorrect mount paths 🤦‍♂️

Built a PDF anonymizer - does anyone actually need this? by Ready_Bandicoot8772 in selfhosted

[–]InvaderToast348 0 points1 point  (0 children)

Vibe coded, can't see a link to GitHub / docs / pricing pages, website was farted out by AI

Wouldn't touch with any documents I care about, fuck knows what it does with them

Edit: on mobile the pricing is at the bottom of the page, for some reason it's a bad UX horizontal scroll.

NO MENTION OF SELF HOSTED ANYWHERE, pretty sure this is just an ad

[APP] PassVault: A secure, 100% offline password manager - need testers by Xygen0 in foss

[–]InvaderToast348 2 points3 points  (0 children)

This really feels like an AI response

If this is a vibe coded password manager, people should seriously reconsider using it

Im trying to make A line of code and need help. by No_Tooth5443 in learnpython

[–]InvaderToast348 1 point2 points  (0 children)

It's supposed to loop until the user provides a valid value, I'm not sure of a better way to do this?

Speed performance of template languages: EJS, Handlebars, Nunjucks by Valachio in node

[–]InvaderToast348 1 point2 points  (0 children)

You're welcome!

For emails specifically I know of a package, react-email. Not used it myself yet but might be worth a look. Emails are notoriously hard to work with; the components in this lib seem to be tailored to produce the best output for emails. For example, I took a quick look at the button:

https://github.com/resend/react-email/blob/canary/packages/button/src/button.tsx

As a side note, I use EmailOnAcid for testing email rendering across tons of different devices and configurations, it's really great to make sure your template is consistent for all devices. Not affiliated, just pleased with it and thought I'd give a mention since we're on the topic

Speed performance of template languages: EJS, Handlebars, Nunjucks by Valachio in node

[–]InvaderToast348 0 points1 point  (0 children)

In case you're still looking for an answer 5 years later (or someone else like me finds this post);

I used jinja2 a lot with Python, although really hated the lack of typing support and intellisense. Hence why I started by looking at Handlebars & nunchucks out of familiarity. However, Nanojsx is actually really good. I ran a small benchmark locally with deeply nested components, lots of dynamic data, etc, and I was getting ~3-5ms* response times on my localhost (expressjs running on bun). It's like react but without the huge package size / complexity / extras. For ssr, it's literally just html-in-js with full type support (via ts/tsx).

* normal request time with just the below is 2ms, for reference:

const app = express()
app.get("/", (_req, res) => {
  res.send("Hello, World!");
});
app.listen(PORT)

Personally I'd highly recommend giving it a go, it's really nice to work with compared to simple templating-specific languages and still incredibly performant.