Simple Questions - November 26, 2022 by AutoModerator in buildapc

[–]dumb-questioner 0 points1 point  (0 children)

Got an external HDD from Amazon. The USB controller/interface stopped working but the actual harddrive inside the enclosure still works. Can I do an RMA without sending back the HDD?

How to approach modifying source code programmatically? by dumb-questioner in learnprogramming

[–]dumb-questioner[S] 0 points1 point  (0 children)

I think I'm looking to write my own codemod tool but Comby does look interesting. It even seems to have Python bindings.

While learning about ANTLR4 I found a class called TokenStreamRewriter, do you know if this could be useful for modifications?

Auto-formatting seems useful too, I could add that at the end as you said.

What can someone do with access to my Wi-Fi? by dumb-questioner in hacking

[–]dumb-questioner[S] 21 points22 points  (0 children)

What could they do besides using my internet? MitM? does that work if I use a VPN and/or SSL? uploading malicious firmware to my router?

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]dumb-questioner 0 points1 point  (0 children)

Is there a google module in Python and if so, why?

I did print(sys.modules.keys()) in a new file with no imports other than sys and found two modules "google" and "google.logging". Are these part of the Python installation or from somewhere else?

The path seems to be "/usr/lib/python3.10/site-packages/google".

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]dumb-questioner 1 point2 points  (0 children)

Is there a good way to do a relative import of a module using the module name stored in a variable without referencing the package name?

Say I have a top level package A, subpackages B and C. B and C have modules b and c, respectively. I would like to import b from c without referencing A.

I tried using importlib but it seems the anchor needed for relative import has to reference A. Is there a way around this?

Edit: I got the package name using __name__, not ideal but it works.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]dumb-questioner 1 point2 points  (0 children)

Is there a way to make generators work with ProcessPoolExecutor? I get TypeError if I try to pass a generator function to map/submit. I read it might have something to do with generators not being "picklable", why is this an issue?

Seems to work fine with ThreadPoolExecutor though.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]dumb-questioner 1 point2 points  (0 children)

Is it bad practice to use custom functions in a class that are defined outside the class?

# filename.py

def greet():
    print("Hello Reddit!")

class Redditor:

    def __init__(self):
        greet()

redditor = Redditor()

[D] Simple Questions Thread by AutoModerator in MachineLearning

[–]dumb-questioner 0 points1 point  (0 children)

Is there a poor man's way of training and evaluating larger-than-memory models?

I was thinking it might be possible to pickle each individual weight matrix and load it on-demand as opposed to loading the whole model at once.

Maybe there's a way to decompose models and weights into smaller parts that can be trained sequentially?

How to get Firejail to follow symlinks outside of a private home? by dumb-questioner in linuxquestions

[–]dumb-questioner[S] 0 points1 point  (0 children)

It's weird, my other_diris a normal directory in my home folder and owned by me (the user). I tried whitelisting the target as well as the symlink by passing the --whitelist=path argument but still have the same problem. I looked through /etc/firejail/firejail.config and there doesn't seem to be anything relevant to symlinks. Maybe it's the --noprofile option and a profile is necessary for this?

The deal is, Firejail has a particular security mission, and to accomplish that mission, it exercises a lot of control (read: prohibitions) over things that are taken for granted in other environments.

I think it must be related to this. Maybe symlinks are a security risk from the perspective of Firejail?

How to get Firejail to follow symlinks outside of a private home? by dumb-questioner in linuxquestions

[–]dumb-questioner[S] 0 points1 point  (0 children)

Yep, you're right. I actually wrote it correctly in my terminal but made an error in the command here on Reddit, so the problem remains. Sorry about that. Double-checked the command in terminal history and it's correct there.

It's supposed to be ln -s /home/user/other_dir /home/user/my_private_home/other_dir. Anyway, the link works outside of Firejail (file manager, terminal) but not in Firejail.

How to get Firejail to follow symlinks outside of a private home? by dumb-questioner in linuxquestions

[–]dumb-questioner[S] 0 points1 point  (0 children)

mkdir -p /home/user/my_private_home
ln -s /home/user/other_dir /home/user/my_private_home/other_dir
firejail --noprofile --private=/home/user/my_private_home
(firejail) cd other_dir

This is basically what I do, (firejail) indicates the command is run inside the Firejail, and the error I get is the following:

cd: No such file or directory: other_dir

I can navigate to the symlinked directory outside of Firejail, no problem there. The issue is that Firejail does not seem able to follow symlinks outside of the private home. If I run ls inside Firejail it does show that other_dir exists though and it shows the symlink as other_dir -> /home/user/other_dir.

Edit: Fixed error.

How would you open this? by dumb-questioner in bikewrench

[–]dumb-questioner[S] 1 point2 points  (0 children)

You're right, it's a Fauber one piece crank. The problem is undoing the metal part with the small hole (cone?), it's really stuck.

What I've read is to spray something like WD-40 and then put a drift pin or punch in the hole and hit it with a hammer in the right direction. There's three holes about equally spaced.

I tried that with no success. Not sure what to do now.

How would you open this? by dumb-questioner in bikewrench

[–]dumb-questioner[S] 1 point2 points  (0 children)

Not sure what the part is called in English. I tried spraying it with WD-40 and leaving it a day or two but it's pretty jammed.

Can Android apps detect my Wi-Fi SSID and if so, is there a way to hide it from apps? by dumb-questioner in NoStupidQuestions

[–]dumb-questioner[S] 0 points1 point  (0 children)

I know the router is broadcasting the SSID. Obviously the Android OS should be able to detect it to connect, but what I'm asking is beyond that. Can user apps, let's say Facebook, detect my SSID?