@thingsiplay@beehaw.org avatar

thingsiplay

@thingsiplay@beehaw.org

This profile is from a federated server and may be incomplete. View on remote instance

thingsiplay OP , (edited )
@thingsiplay@beehaw.org avatar

From https://github.com/python/cpython/blob/3.12/Lib/pathlib.py

class PosixPath(Path, PurePosixPath):
    """Path subclass for non-Windows systems.

    On a POSIX system, instantiating a Path should return this object.
    """
    __slots__ = ()

    if os.name == 'nt':
        def __new__(cls, *args, **kwargs):
            raise NotImplementedError(
                f"cannot instantiate {cls.__name__!r} on your system")

Which sub classes PurePosixPath, which itself is basically just PurePath with a Posix flavour to it. And Path itself is PurePath as well. Not sure if I should copy paste them here.

Edit: So I added these to my reply:

PurePath

    def __new__(cls, *args, **kwargs):
        """Construct a PurePath from one or several strings and or existing
        PurePath objects.  The strings and path objects are combined so as
        to yield a canonicalized path, which is incorporated into the
        new PurePath object.
        """
        if cls is PurePath:
            cls = PureWindowsPath if os.name == 'nt' else PurePosixPath
        return object.__new__(cls)


    def __init__(self, *args):
        paths = []
        for arg in args:
            if isinstance(arg, PurePath):
                if arg._flavour is ntpath and self._flavour is posixpath:
                    # GH-103631: Convert separators for backwards compatibility.
                    paths.extend(path.replace('\\', '/') for path in arg._raw_paths)
                else:
                    paths.extend(arg._raw_paths)
            else:
                try:
                    path = os.fspath(arg)
                except TypeError:
                    path = arg
                if not isinstance(path, str):
                    raise TypeError(
                        "argument should be a str or an os.PathLike "
                        "object where __fspath__ returns a str, "
                        f"not {type(path).__name__!r}")
                paths.append(path)
        self._raw_paths = paths

Path


    def __init__(self, *args, **kwargs):
        if kwargs:
            msg = ("support for supplying keyword arguments to pathlib.PurePath "
                   "is deprecated and scheduled for removal in Python {remove}")
            warnings._deprecated("pathlib.PurePath(**kwargs)", msg, remove=(3, 14))
        super().__init__(*args)

    def __new__(cls, *args, **kwargs):
        if cls is Path:
            cls = WindowsPath if os.name == 'nt' else PosixPath
        return object.__new__(cls)
thingsiplay OP ,
@thingsiplay@beehaw.org avatar

I think in Python 3.11 and prior overriding new was needed in order to subclass it correctly, because it was buggy until 3.12. This was a workaround, if I remember correctly. I already tried without new and setting self__source, but couldn't make it work. I was close!

With your suggestion it works now! I will need to test the app a bit now and if everything looks fine, will update the repository. Did exactly what you said and replaced this part:

# class File(PosixPath):
#     def __new__(cls, *args: Any, **kwargs: Any) -> Any:
#         return cls._load_parts(args).expanduser().resolve()  # type: ignore
#
#     def __init__(self, source: str | Path, *args: Any) -> None:
#         super().__init__()
#         self.__source = Path(source)
#
class File(PosixPath):
    def __init__(self, source: str | Path, *args: Any) -> None:
        self.__source = Path(source)
        super().__init__(Path(source, *args).expanduser().resolve())

Thank you for the help and solution!

Edit: Forgot to answer your question. This could work without subclassing too off course, but doing it this way makes it more clean in my opinion. It's the natural way to me to extend functionality and use the extended version for the purpose its designed to. It's not strictly required and I would have done it otherwise too, if this was problematic and not working.

thingsiplay OP ,
@thingsiplay@beehaw.org avatar

The other person got me the solution. __new__() is no longer needed to be overwritten anymore.

My Linux Command Line Tools ( thingsiplay.game.blog )

A short list with categories of my smol terminal focused tools, scripts and functions I have created over the years. There are some general purpose and very specific ones. This list was needed, because in Github it was a bit cluttered. Maybe, just maybe, you find something useful or inspiring in there.

thingsiplay OP , (edited )
@thingsiplay@beehaw.org avatar

I've seen this before. It's a nice visualization. As for the "biggest" script, its not as slow as you think. It's a single du call (alongside cheap sort, head and tac) and therefore quite fast. In example in my ~/Documents directory is almost 1 TB big and running time biggest Documents executes it in almost 2 seconds (for the first time after a reboot). Subsequent calls are quicker, 0.6s and then 0.07s. Edit: And BTW, it's a mechanical HDD, not SSD too.

Also I like the output of the files or folders and I can even use commandline arguments like biggest Documents/*.txt in example. So for me this is enough and exactly what I need.

Did I just solve the packaging problem? (please feel free to tell me why I'm wrong)

You know what I just realised? These "universal formats" were created to make it easier for developers to package software for Linux, and there just so happens to be this thing called the Open Build Service by OpenSUSE, which allows you to package for Debian and Ubuntu (deb), Fedora and RHEL (rpm) and SUSE and OpenSUSE (also...

thingsiplay ,
@thingsiplay@beehaw.org avatar

Why would PKGBUILD solve the issue? The packaging issues are still the same, as every distro has different package names, revisions and not all packages in their repository. The dependencies are not solved with this.

thingsiplay ,
@thingsiplay@beehaw.org avatar

Same for side loading apps. If the rest of the world / governments does not care, then Apple won't care in the rest of the world too.

thingsiplay , (edited )
@thingsiplay@beehaw.org avatar

One of my favorite blogs recently.

A few weeks ago, some of us discovered that KDE apps just looked terrible when run in GNOME.

They should test this much more often and frequently. Unlike Gnome, KDE do actually care about their users, not just about themselves.

Dolphin now gives you the option to enable previews for folders on remote locations.

I wouldn't use this for internet connections, but when accessing my Steam Deck through Dolphin on my PC, then this could be fast enough for smaller directories I guess. Meaning as long as the remote location is in the LAN and not the internet, the performance wouldn't be too bad I guess.

Discover now handles the case where one of your Flatpak apps has been marked as “end of life” and replaced with another one; it gives you the opportunity to switch to the new one, or cancel and keep using the old one anyway

Wow! This is a topic we discussed a lot in the web. Not for Flatpaks but often for native package managers like in Fedora or Archlinux, where no longer supported programs are still in the repository (such as neofetch). I still wish this check from Discovery app would be on the side of the package managers+repository information like Flatpak+Flathub itself, as I do this in commandline only. But very nice to see how KDE improves on this front.


BTW a personal little problem from me: My Application Launcher menu is very slow with bad performance. It always freezes for half a second goes loads when I move mouse and freezes again. Does anyone experience this issue?

thingsiplay ,
@thingsiplay@beehaw.org avatar

I don't use SMB. It's SSH connection using Files transferred over Shell protocol (FISH).

thingsiplay ,
@thingsiplay@beehaw.org avatar

I didn't change from any desktop environment. But I think that I also use Gnome applications, not sure. cleaning .config or .local directory is not an option for me.

thingsiplay ,
@thingsiplay@beehaw.org avatar

Reddit has become one of the internet’s largest open archives of authentic, relevant, and always up-to-date human conversations about anything and everything.

Reddit CEO Steve Huffman says

But refuses to pay the users or at least moderators who build Reddit to what it is now. Instead, it pushes more advertisements and sells data to AI companies for millions of Dollars.

thingsiplay ,
@thingsiplay@beehaw.org avatar

The license does not apply to posts and replies in Reddit, right? Thank god I created a blog to post about any stuff that I want, without license or restrictions from Reddit. Before the AI breakthrough and what happened to Reddit. But even if so, do AI tools understand such a license text and evaluate if they can or cannot use the material?

thingsiplay ,
@thingsiplay@beehaw.org avatar

Well the companies and developers don't decide for every single material. In example what I expect is, that they program the scraper with rules to respect licenses of individual projects (such as on Github probably). And I assume those scraper tools are AI tools themselves, programmed with AI tool assist on top of it. There are multiple AI layers!

At this point, I don't think that any developer knows exactly what the AI tools are fed with, if they use automatically scraped public sources from the internet.

thingsiplay OP ,
@thingsiplay@beehaw.org avatar

fpath is not a replacement for a ls like command, but to change its output (I am an eza user myself). fpath takes output of eza to transform it into whatever I want. And its not just usable with an list program such ls or eza, but also operates on stdin like grep, even non existent files to maybe form something on a different place with same name in example. I still use ls (which is eza for me as an alias) for regular day operation.

fpath is useful for output from find command or baloosearch6 (KDE's file indexer, that only outputs full path of matching search). In this case eza does not help me. Sometimes it can get messy with using sed and grep mulitple times and Bash substitution to get file extension and so on. Or I use baloosearch6 "Super Mario World" | fpath -F{name} -x*.pcm to just show filename, excluding all paths matching *.pcm glob (not regex) for whatever reason I want to use. The thing is, this is just a moment to be in. Next moment I can easily adjust the output to output it with or without other information.

thingsiplay OP ,
@thingsiplay@beehaw.org avatar

It's a bit hard to show examples that justifies such a tool. But it's not about making things possible, as there are other tools like ls, grep and sed and awk and Bash commands to do all the formatting and output. But its a little bit easier and more flexible to have fpath, which understands paths and has dedicated functionality to support that. It's more about being flexible and doing it in place easily. At least for me, because I know the tool.

Let's say I want to output some information about files that come as a result from my file indexer baloosearch6 (from KDE). It only outputs full paths. Let's say I want to show only its names and the file type information (or any other) next to it:

baloosearch6 "Super Mario" | grep /snes/ | fpath -F'{name}\n\t{file}\n'
thingsiplay ,
@thingsiplay@beehaw.org avatar

Human Rights are higher than any law. Just because its law in China, does not mean it is correct to follow the law. It is not we decide which laws to follow, but it is universally in entire world the right thing to support Human Rights, regardless of any law.

thingsiplay ,
@thingsiplay@beehaw.org avatar

It is literally either follow this law or cease operations here. Both would end in the song being blocked anyway.

Which does not change the fact that Google does it. So the reason why Google supports China and their anti Human Rights laws is, because of money. That's what we criticize.

thingsiplay ,
@thingsiplay@beehaw.org avatar

This would probably make the entire world talk about it and it would be worse in China, because this would only anger people and fighting against the country. We won't see that, because Google wouldn't dare. The money is more precious than any Human Right, regardless of law.

thingsiplay ,
@thingsiplay@beehaw.org avatar

Brodie is my favorite Linux YouTube. I personally don't agree with your statement about full of unnecessary fluff. However, some of the videos are a bit useless, but I have to come across any YouTuber or content creator in general who produces only good stuff. Besides that, his videos are educational, entertaining and on the point. He often does historical documentation too and covers some drama as well (to be fair, the drama stuff is just for fun and he does it a bit too often in my opinion).

Brodie also plays games and streams, but that is something I never watched and was not interested into watching. I rather play games myself.

thingsiplay ,
@thingsiplay@beehaw.org avatar

I agree with you in this, that I don't like watching most stuff on YouTube and prefer short articles to read (unless they are written from an AI, which plagues most blogs now). But recent years I became more and more of a YouTube/video consumer and sometimes just sitting there and watching for pure fun is also cool. But I absolutely get what you are saying. Maybe I'm a bit used to his style now.

Often when I watch others, it feels such a waste of time. I have memorized to use jumping to next chapter with keyboard shortcut Ctrl-right, which is a godsend, plus SponsorBlock addon (not only for sponsors, but also for outros, recaps, interaction reminder and such). I even watch many videos at higher speed, often x1.2. Many people are talking too slow in my opinion, but Brodie is not one of them.

fpath: Reformat and stylize file path like text output. (Python, terminal) ( github.com )

I did it again; exaggerate a simple idea and make it look more complicated at the end with too much text in the readme. I was bothered with the output of file listings and how unreadable they can get, especially with long paths and many of them on screen. At the end, I am not sure how useful this will be in the long run, but...

thingsiplay ,
@thingsiplay@beehaw.org avatar

Did you mean 1MB? With correct settings, you get under 1MB Rust binaries and with even more compression using upx it gets to 300KB, probably less for much simpler applications. Rust applications aren't that big of a deal as people make it to be; within reasons off course.

thingsiplay , (edited )
@thingsiplay@beehaw.org avatar

How can this even relate to the ideology of the first document? I am deeply saddened by these new rules.

The previous document was written in a time when only C was the language in the Kernel. Now that two different languages and eco systems exist, it makes lot of sense to not mix them up. The document with guidelines for C code was needed, because there was no uniform guide that every user used. But with Rust it is different. There exist rustfmt and practically every user is learning and writing code with it and every public documentation and library is using this tool; most of them with default values.

You don't mix C with Rust anyway, so why do you want force every Rust programmer and code formatted like C? I don't think this is an issue that needs to be fixed. Are you programming for the Linux Kernel? Do you do it in C and Rust? Otherwise, why do you think this is a problem?

Edit:
Also the very first paragraph and second sentence in the linked document says this:

Coding style is very personal, and I won’t force my views on anybody, but this is what goes for anything that I have to be able to maintain, and I’d prefer it for most other things too.

But you seem to ignore that and force everyone to write code like this, declaring it to be an issue in the code (which it isn't). Do you not think that other Linux developers didn't think of this? Why is this an issue that has to be fixed and how do you explain this? Why does the C coding standard apply to Rust, when Rust has its own established one?

thingsiplay ,
@thingsiplay@beehaw.org avatar

To be fair, consistent styling across the entire project is not meaningless. But on the other side, I don't think this needs to be fixed here, because it is already consistent (within their language).

thingsiplay ,
@thingsiplay@beehaw.org avatar

8 space-long, hard tabs.

Hard disagree. 8 spaces is waste and 4 should be industry standard. Tabs should not be used for indentation, but spaces. On the other side, Tabs are configurable, so that's actually a plus point.

80 character limit instead of 100.

Why? 80 is an old standard with limitations that do not apply today anymore. We have wider screens and higher resolutions. While it makes sense to keep this to be consistent with previous code and language defaults for C, there is no reason to enforce this for the new adopted language, which already has a standard on its own.

And yes rustfmt can be configured and when I started with Rust I changed max_width to 80, just because I was used to it with Python. But there is no benefit doing this in Rust.

thingsiplay OP ,
@thingsiplay@beehaw.org avatar

I always found it a bit nebulous to have the "or later" statement / option. Because that is not precise and which GPL is meant to? Everyone can write a new version of the GPL. The "or later" does not specify which, it just implies it would be GNU GPL. It's been a long time since I read and studied the GPLv2, never v3 and I actually never really understood how the "or later" would be allowed.

Licensing is still confusing, even after more than a decade.

thingsiplay OP ,
@thingsiplay@beehaw.org avatar

And I appreciate the help in understanding the subject. I am actually someone who reads licenses and sometimes dig into terms to get an understanding of very specific subjects, but got a bit too comfortable lately and need to catch up. I plan on reading the GPLv3 too, but this needs a bit time and effort. So until then I'll ask around.

thingsiplay ,
@thingsiplay@beehaw.org avatar

Ext4: It's the most common used and most mature filesystem we have. You can use any rescue system without pitfalls, in case your system fails. Some other filesystems have edge cases or a special setup is required. I am not saying they are bad or so, just saying if you have to ask this question to a public forum, then it's probably more safe to just use the default Ext4 system. It's battle tested for ages.

thingsiplay ,
@thingsiplay@beehaw.org avatar

I was always wondering if there could be a small Linux partition for additional information of NTFS partitions, like meta data stored as a separate file (or database). And off course it would need some virtualization layer like WINE does for the file path mapping. Then it would be possible to use NTFS as system drive and for games.

Obviously this would be problematic and performance wouldn't be great either (assuming), and it would complicate things for end user and developers too. But I was always thinking if this would be possible.

thingsiplay ,
@thingsiplay@beehaw.org avatar

When I first read the headline, my first 2 assumptions where:

  • another AI driven development, which writes multiple lines and assumes complete logic and what you want to do
  • dependent on the internet

After your comment (I can't verify, but assume you are serious) sounds actually good if its just trying to autocomplete stuff. I have yet to see any AI driven autocomplete system that does just that. But the other fact (according to the article) is, it's not dependent on the internet. This is huge! One of the biggest downsides of AI tools is, that they rely on the internet to send data back and forth.

Unfortunately this is closed source. And when I stop paying subscription, while being addicted and dependent to it, would be bad for me. I get it, its a buisness model and they have to make money without others stealing or using their products for free. But I am super curious to where this leads and if this tech is truly better than its competitor. Sorry for my rambling.

thingsiplay ,
@thingsiplay@beehaw.org avatar

This is such a broad topic, its impossible to give an advice or place that works for everyone. What I would do is pick up a few common commands that are not destructive in their nature (no need to practice with rm command in example) and read its manual man grep and help grep --help . Then try to understand and play around with the options and dedicated test files. Search tutorials and tips for these specific commands you are learning about. Over time this should result in deeper understanding of various concepts, as as you learn about grep, you will also learn about pipes and files in general while you are researching.

Then you can move on to other commands. Maybe setup a virtual machine where you can experiment a bit more freely, but that's probably overkill. Also look what people do in their Bash scripts, as Bash is contains the commands you can use on the terminal too.

thingsiplay ,
@thingsiplay@beehaw.org avatar

Yeah, I'm this type of person, learning by doing. Doing dedicated courses or tutorials was never my thing. But other people are not me, right? Here is another website that might interest you: https://linuxjourney.com/

thingsiplay ,
@thingsiplay@beehaw.org avatar

Lol I wasn't aware that nano is actually a GNU project. Checking the date on Wikipedia when it became one really threw me off today morning: 2001. Man I was living behind the moon and could not exit properly the entire time!

thingsiplay ,
@thingsiplay@beehaw.org avatar

Trained on YouTube clips

It could have been worse. Imagine trained by Tik Tok clips.

thingsiplay ,
@thingsiplay@beehaw.org avatar

Money.

thingsiplay ,
@thingsiplay@beehaw.org avatar

a bad uncanny-valley 75% accurate version of one

Actually a perfect description of what a deepfake is.

thingsiplay ,
@thingsiplay@beehaw.org avatar

Finally it's official. I think it's a good move to make it an archived repository, so everyone knows for a fact this is not developed anymore. That means bugs or security issues are no longer actively searched and corrected. I wonder if this program will be taken out from distribution repositories now. My personal alternative is fastfetch .

Edit: ... oh, I didn't realize all of his repositories are now archived. Not only neofetch: https://github.com/dylanaraps?tab=repositories

thingsiplay ,
@thingsiplay@beehaw.org avatar

Looking at the readme edit history: https://github.com/dylanaraps/dylanaraps/commits/master/

  1. First edit 3 years ago: Away till the New Year. Merry Christmas.
  2. Then next edit 10 month ago replacing that line with: On hiatus.
  3. Then next edit 4 days ago replacing that line with: Have taken up farming.

English is not my native language, and I don't understand what "Have taken up farming.", but I have my guesses. means. Normally I don't interpret such a situation, but it doesn't look good. Most contributions of the software is 3 years old, and only a few readme and link updates recently are made alongside making everything archived.

thingsiplay ,
@thingsiplay@beehaw.org avatar

Hmm, maybe it really means it literally. I mean it would not surprise me if the person really started or taken over by farming and giving up programming. Be it having too much pressure from all sites, for writing software that many people use. Or be it financial. Who knows. I wish him best luck.

thingsiplay ,
@thingsiplay@beehaw.org avatar

As long as it works perfectly and it makes no security related headlines, i’m fine with running abandoned ware.

That means Windows XP is perfectly okay as abandon ware, becuase it makes no security related headlines. :p (just joking!)

thingsiplay ,
@thingsiplay@beehaw.org avatar

For such a project, I think a different structure would make more sense. A structure where each supported package manager is a module on its own (like module/pacman.sh) and contains all the logic for this specific package manager. Those modules would only contain functions. And the main script with the main logic and loads in the module would not know or check what package manager it uses, but instead just runs the functions that are named the same in each module. But that would obviously require a major rewrite.

thingsiplay ,
@thingsiplay@beehaw.org avatar

When you extract file and create a new folder/directory, then off course it is treated as recently modified, because you just created it. This is much different than just extracting a directory from archive as it is to preserve its original attributes.

I just tested and observed following:

  • Open archive file by double clicking in the default application Ark (with GUI). Extract a sub directory from the archive by dragging it out into my filemanager Dolphin. The original last modified date is preserved.
  • On the contrary, I right mouse click the archive in my filemanager Dolphin and use the Extract > Extract here menu entry. This will extract the files and the sub directories have new last modified dates, but not the files. This does not need any manual folder creation by you.

I assume you want to solve this by only using the GUI. Because using commandline in the terminal these stuff could be solved. With a script this can be even automated. On the other hand, maybe you (or someone else) could create a script with the exact behavior you wish and then you can just right mouse click on the archive, and choose "open with ... the_special_script", which also updates the folder with newest last modified date in example.

thingsiplay ,
@thingsiplay@beehaw.org avatar

I removed my other reply, as it is a bit complicated and not straight forward. I thought a little bit about this how to communicate all of this with you, so it is easy to understand. Problem is, this is not easy. Without confusing you again, I want to say it even depends on the file format. In the one tested .7z file the date was preserved for a subfolder inside a folder from the archive. It was not the same for a .tar.gz. Maybe it depends on how the dates were saved in the archive too.

And then it's really confusing thing in the graphical interface of Ark is, when you double click the file and it opens the window. When you extract a subfolder with dragging it out /dir/subdir/ then subdir has new date. But if you extract /dir directly (which includes all subdirs), then subdir has old date, but /dir has new date.

I tested here and there stuff and my conclusion is, its a mess (at least with Ark, I did not test other tools for this, because you are using Ark). As someone else said, you can use touch command to change dates to current date. This could be automated with extraction of archive and using touch command, but this gets involving, especially if you want to have it as a command in the mouse popup menu of your filemanager.

thingsiplay ,
@thingsiplay@beehaw.org avatar

Firefox has a reader view mode, which I can enable by clicking an icon in the address bar. But for some reason, this icon will not appear for this website here. I even have enabled a setting in the about:config that this icon should be shown for all pages, but it will not for this site.

I used darkreader in the past. But I could not find a solution to just enable temporarily for the current page I am reading. I don't want to enable for all pages. But you actually reminded me of another plugin I totally forgot: Tranquility Reader https://addons.mozilla.org/en-US/firefox/addon/tranquility-1/ and it does exactly what I want and works for this page too. A click will turn it into a readable text temporarily (default black on white, but changeable). So I guess this is a solved problem for me now? Thanks to you, because otherwise I would not remember and lookup again.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • news
  • movies
  • leopardsatemyface
  • stillalive
  • ServerNonsense
  • istillthinkofyou
  • oneorangebraincell
  • MBBS
  • All magazines