@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.

thingsiplay ,
@thingsiplay@beehaw.org avatar

Also recommended to watch: The History of Tetris World Records

  1. 2:32 Chapter 1
  2. 11:39 Chapter 2
  3. 16:28 Chapter 3: ENEOOGEZ
  4. 25:48 Chapter 4: Hypertapping
  5. 31:45 Chapter 5: The Next Generation
  6. 49:00 Chapter 6: Rolling
  7. 1:00:27 Chapter 7: Vaulting & Scaling
  8. 1:15:25 Chapter 8: Colors
  9. 1:25:00 Chapter 9: Crash
thingsiplay ,
@thingsiplay@beehaw.org avatar

Its a classic conflict of interests. But I believe he is a sportsman guy and truly was happy for the kid. Kinda felt bad though, but this is how things goes. Either way, congratz to both.

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.

The History of Tetris World Records [by Summoning Salt] ~ a 2 hour documentary ( youtu.be )

I just watched an excellent 2 hour (just needed to edit title, as I noticed it was 2 hours and not 1, wow time really flew away!) long documentary. The build up in stages and showing the evolution of the best players achievements, is intense and very well edited, narrated and written documentary!...

thingsiplay OP ,
@thingsiplay@beehaw.org avatar

You can watch them piece by piece (meaning if its broken up by chapters like this), if its too long. I personally don't do that, but can absolutely understand it. Nowadays I also watch most videos at higher speed. Some talk really slow, I mean slow that I watch it at x1.4 speed and it sounds like someone else is talking at x1.0 speed. But this video, I didn't have a problem with the narration itself.

BTW I recommend Looking for an addon or like that if you watch on a browser. I have a more fine control over the speed values, as x1.25 sometimes is too fast. In example I often watch at x1.1 by default or sometimes at x1.2... and in really bad cases even faster.

Are there any WYSIWYG html editors? just curious

Hello, i was looking for a wysiwyg html editors i could use for my personal website, perferrably just as a simple open source desktop program on linux (though anything else is fine). i DID find something called KompoZer but i was wondering if there's any other ones, thanks

thingsiplay ,
@thingsiplay@beehaw.org avatar

I have no one to recommend, but you might find something from this list: https://github.com/JefMari/awesome-wysiwyg-editors

As others recommended, using a web browser to edit is actually pretty cool, especially in Firefox. I myself use Wordpress in the browser instead, which has such a builtin editor.

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

This is good to know. I usually have a mixed set of applications for stable and non stable, depending on how much I trust the devs for this. If the release of Gimp 3 wouldn't be on the corner, I probably used it too.

I'm on Linux and use Wayland (details not important if you are not familiar with it) and Gimp 3 still has a few issues regarding that. At least based on their own notes, so I will wait a few weeks (or months) longer, because I am not at a hurry at the moment. Can't wait for this massive update and a huge step forward! Glad to hear it is already working well (I would assume that if they are close to release.)

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 OP ,
@thingsiplay@beehaw.org avatar

Oh that's good to know! Yeah, I never liked the "or later" too. To be fair, the software you licensed won't change the license if a new updated version comes out. It's just a third party can opt-in. So this is not a situation like a software agreement where the publisher can change the agreements at any time with full effect, despite you agreed to a prior agreement. I don't think "or later" is evil, but I personally don't like anything that is not explicit.

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.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • All magazines