Threads for TeddyDD

  1. 13

    Godot UI components are great. I hope Godot gets a11y features like support for screen readers.

    1. 1

      Mostly meta projects like fisher and plugins.

      1. 6

        My rule of thumb is: if it cannot be done in one page of POSIX sh - rewrite it in real programming language.

        1. 7

          Or a couple or three of programs written in a real programming language, glued together with POSIX sh.

          1. 6

            Nice!

            Seriously: shellcheck will catch “useless” cat in scripts. In interactive work, use cat to your heart’s content ;)

            1. 2

              I dislike only two things about Lua

              1. Global scope by default

              2. No trailing comma in function signature

                 function foo(
                     a,
                     b,
                 ) -- invalid :(
                
              1. 2

                Is there any language that allow trailing commas in function signatures?

                1. 2

                  Python does.

                2. 1

                  2 is a bit strange because I am pretty sure that trailing commas in table declaration are acceptable.

                1. 15

                  I’ve been using Fish since 2015, and it’s been great. Fish not being POSIX compatible hasn’t been an issue in practice, though I don’t do a lot of shell scripting to begin with. If somebody is curious about my Fish configuration, you can find it here.

                  1. 4

                    For me the lack of sh-compatible syntax has been a real problem, to the point where I switched to bash at work. Fish does have the best user experience I’ve seen, but the need for specific Fish scripts is a problem, in particular with Nix or any tool that you need to load from your profile. There are wrappersz like bass, but they don’t always work and have overhead.

                    1. 30

                      Just because fish is your interactive shell doesn’t mean that you need to start shell scripts with !/usr/bin/env fish.

                      1. 9

                        I never understood what people is doing all day in their prompt that needs POSIX compatibility. The syntax to call commands is the same.

                        I think it is mostly a meme or a simple matter of running copy pasted scripts from the web and not understanding how interpreter resolution works or that you can manually define it.

                        1. 1

                          Not necessarily whole scripts. Sometimes you want to paste just a couple commands into the interactive prompt.

                        2. 3

                          But for stuff like Nix, don’t you have to run the setup scripts in your interactive shell with source or equivalent, so they can set environment variables and such?

                          1. 3

                            In Unix, all child processes of a process will inherit the parent’s environment. You should be able to write all your scripts as POSIX compliant (or bash compliant) and run them from inside fish without an issue, as long as you specify the interpreter like so: bash myscript.sh

                            1. 8

                              The problem, if I understood it right (I’ve never used things like Nix) is that these are not things you’re supposed to run, but things you’re supposed to source. I.e. you source whatever.sh so that you get the right environment to do everything else. Sort of like the decade-old env.sh hack for closed-source toolchains and the like, which you source so that you can get all the PATH and LD_LIBRARY_PATH hacks only for this interactive session instead of polluting your .profile with them.

                              1. 1

                                I see, that makes sense. I guess I didn’t consider that, wonder how the activate script generated with a Python virtual environment would work with Fish. Even a relatively fancy .profile file might be incompatible with Fish.

                        3. 8

                          I usually just switch to bash when I need to run a command this way. And honesty I’m more annoyed at commands like these that modify your shell environment and thus force you to use a POSIX-compatible shell, than I am at fish for deliberately trying something different that isn’t POSIX.

                          1. 1

                            Fortunately some commands are designed to output a shell snippet to be used with eval

                            eval $(foo) # foo prints 'export VAR=bar'
                            

                            In that case you can pipe output of foo to Fish’s source

                            foo | source
                            
                            1. 2

                              No, that’s exactly what you can’t do, the code won’t be valid for source-ing (unless those commands specifically output csh-style rather than posix-style script)

                              Though apparently these days fish does support the most common POSIX-isms

                              1. 1

                                I mean only the case where you set env variables (like luarocks path)

                          2. 4

                            I also had problems with bass. It was too slow to run in my config.fish. However, I switched to https://github.com/oh-my-fish/plugin-foreign-env and it’s worked perfectly for me. And you don’t need oh-my-fish to use it — I installed it with the plugin manager https://github.com/jorgebucaran/fisher.

                            1. 2

                              Ah, I hadn’t seen this one, if it succeeds to setup Nix then it’s party time!

                              1. 3

                                Not a fish user, but since you’re a Nix user I would also recommend checking out direnv which has fish support. For nix in direnv specifically I would also recommend something like nix-direnv (and several others) which caches and also gcroots environments so overheads are next to negligible when things remain unchanged.

                              2. 2

                                That looks good enough to make me want to try fish again. I had not seen it last time I tried fish. Thanks for pointing it out.

                          1. 3

                            The first time I used fish, I hated it so much I’ve never given it a second chance.

                            I just hated how different it was from POSIX shells for interactive use (I’ve never scripted with it). But I think that’s it’s selling point to some people.

                            To each their own I suppose.

                            1. 12

                              The POSIX incompatibility is less annoying than it used to be. For me, the most annoying things was && and || not working — that’s been fixed since fish 3. I also recently discovered that VAR=foo cmd ... works now, whereas before you had to do env VAR=foo cmd ....

                              1. 2

                                export VAR=foo works as well

                            1. 23

                              I love the attitude: you probably shouldn’t take it apart, but it’s your hardware, so here is instruction how to do this correctly.

                              1. 18

                                That’s the sort of attitude that IMO has made Steam basically the least-evil software distribution store. Not a high bar, unfortunately, but it’s something.

                                1. 9

                                  They’re doing some pretty good work with Proton too, they claim the whole Steam library will be playable on the Steam Deck when it releases. Maybe the day I can switch my gaming PC to Linux isn’t too far off.

                                  1. 7

                                    Yep, and it coincidentally started happening just around the time that Microsoft was saying that the MS Store would become the only way to install programs on Windows 10. Somehow, Microsoft eventually decided that was a bad move once Valve started putting serious work into Linux compat and helping game developers port their games.

                                    Though it also means that about half my own game library works pretty darn well on Linux, so, can’t complain too much.

                                    1. 4

                                      Obviously it’s in their own self-interest to do it, and they’ve been pushing it so that they don’t have to pay Microsoft to preinstall Windows on their consoles, but it’s still a good thing overall.

                                      1. 2

                                        Yeah, I believe this is part of the reason Valve has embraced Linux since so long ago. Basically a bit of insurance against the dominance of Windows. I imagine they were well aware of the extreme dependence on MS playing nice (or whatever). I feel like I’ve read more about this very subject, will see if I can dig up any links or anything…

                                      2. 6

                                        Apparently they are getting anti-cheat software to be work in Linux too (EAC for example) which I thought I would never see happen in my lifetime.

                                        1. 2

                                          I’m really curious about this. The closest any of these kernel-mode anticheats has come to Linux before is EAC, where they had an extremely basic version briefly for the game Rust, and were also working on a version that worked in WIne. Those were cancelled the moment Epic Games bought them though, so I’m unsure if they’ve managed to build limited support for the drivers into Proton, or whether they’ve made a deal with Epic to get that wine version going again.

                                      3. 5

                                        GoG is [almost] DRM-free, so I try to buy most games there. I wonder how to balance all of the evils against one another to choose the “least-evil”.

                                      4. 8

                                        All things considered, it’s quite amazing that it just takes 8 screws to open the unit and 3 more to replace the thumbstick. Replacing the internal SSD takes 4 more screws but they strongly discourage people from changing it just because they claim that the one that comes installed on it is selected for (1) power consumption and (2) minimal interference with the wifi module (but they also upcharge for more storage, so maybe they just don’t want people to buy the cheap version and swap the ssd on the side).

                                        It seems that they put some thought on trying to make the steam deck as serviceable as possible given its form factor.

                                      1. 7

                                        It doesn’t sound like they’ve fixed the complaints articulated here.

                                        That’s enough to make me prefer other options when they’re available to me.

                                        1. 12

                                          No one likes breaking changes either. Damned if you do, damned if you don’t.

                                          1. 4

                                            Damned if you do, damned if you don’t.

                                            I agree. And to strain the reference: So dammit, I will use something else.

                                            1. 6

                                              All JSON is valid YAML. Just use JSON.

                                              1. 4

                                                They don’t really target similar uses though? I don’t love YAML, but JSON is not really meant for human authoring, especially when large or repetitive

                                                1. 5

                                                  TOML is really the best of both worlds IMO. Easy to read/write, hard to screw up.

                                                  I’d also say that there’s really no human serialization language that handles repetition well. YAML has its anchors and stuff but that’s footgun city. HCL has for_each which is good but also has a steep learning curve. Writing real code and dumping to something else is my preferred method if HCL isn’t an option.

                                                  1. 3

                                                    I don’t mind YAML anchors so much, but if I really want this kind of feature I’m reaching for Dhall for sure

                                                  2. 2

                                                    All JSON is also valid UCL as well. UCL actually supports all of the things I want from a human-friendly configuration language, such as well-defined semantics for loading multiple files with overrides (including deletion), so if you want to avoid complex parsing in your main application then you can have a stand-alone unprivileged process that parses UCL and generates JSON.

                                                    Anything where I might want YAML, I’ve found either JSON or UCL a better choice. JSON is much simpler to parse and has good (small!) high-performance parsers, UCL is more human-friendly. YAML is somewhere between the two.

                                                  3. 3

                                                    One small nit: the YAML spec disallows tabs, while JSON allows them. In practice, I don’t know of any YAML parser implementations that will actually complain, though.

                                                    1. 2

                                                      I haven’t used a YAML parser that allows tabs in YAML syntax, but appearing inside inline/json syntax they may be more lax

                                                    2. 1

                                                      This is the only good thing about YAML

                                                2. 4

                                                  I agree with several of the issues pointed out on that page and it’s sibling pages, but some of the headache experienced is a direct result of libyaml(and thus pyyaml). It still doesn’t properly support YAML 1.2, which defines booleans as true/false. That is still a nasty thing though when wanting to use the literal word true or false, but at least it avoids the n,no,y,yes, and the various case differences. 1.2 only supports true, false.

                                                  libyaml also doesn’t generate errors on duplicate keys, which is incredibly frustrating as well.

                                                  The criticism of implicit typing, tagging, typing, flows, yaml -> language datatype, etc. are all spot on. They are prone to errors and in the latter case make it really easy to introduce security issues.

                                                  1. 2

                                                    That is still a nasty thing though when wanting to use the literal word true or false, but at least it avoids the n,no,y,yes, and the various case differences. 1.2 only supports true, false.

                                                    Are you sure? https://yaml.org/spec/1.2.2/#other-schemas seems to be saying that it’s fine to extend the rules for interpreting untagged nodes in arbitrary ways. That wouldn’t be part of the “core schema”, but then nothing in the spec says parsers have to implement the core schema.

                                                    1. 2

                                                      Whoops. You are correct. The three described schemas are just recommendations. The lack of a required schema is frustrating.

                                                      The described recommended schemas define booleans as true, false, which is a change from what versions less than 1.2 had.

                                                      I’ll say that I personally get frustrated quickly with yaml.

                                                  2. 3

                                                    Any language that supports bare strings will have issues when you also have asciinumeric keywords.

                                                    An issue? Sure, but more a tradeoff than anything else.

                                                    1. 4

                                                      The problem with the bare string interpretation, as I see it, is not so much the fact that it exists. It’s that it’s not part of the spec proper, but a set of recommended additional tags. What do you think 2001:40:0:0:0:0:0:1 is? Not the number 5603385600000001? The YAML spec, to the extent it has an opinion, actually agrees, but many YAML parsers will interpret it as 5603385600000001 by default, because they implement the optional timestamp type.

                                                      YAML 1.2 doesn’t recommend https://yaml.org/type/ any more, but it doesn’t disallow it, either. The best part of all this is that there are no strict rules about which types parsers should implement. If you use a bare string anywhere in a YAML document, even one that already has a well-understood meaning, the spec doesn’t guarantee that it will keep its meaning tomorrow.

                                                  1. 4

                                                    I’ve been using it for years, but apparently stuff like gdu is faster for SSDs now.

                                                    1. 3

                                                      I like how Fish’s config files works. In ~/.config/fish

                                                      ├── completions # autocompletion scripts
                                                      ├── conf.d      # all files from this dir are sourced automatically
                                                      └── functions   # sourced when function is used
                                                      └── config.fish # .bashrc equivalent
                                                      

                                                      It’s easy to keep things organized with this layout.

                                                      1. 2

                                                        this is pretty cool. i did a similar thing ages ago, but with the bee movie script. because i needed to do /something/ to get through computer science classes at high school, i also went through the script and modified it to use the toki pona phonology, which didn’t get me as far as i wanted, but did get me farther than using the full alphabet.

                                                        1. 1

                                                          I encoded 3 books as QR codes and printed them as part of my bachelor’s degree graduation work. Something between conceptual and generative art lol. They were not compressed (so you could scan any part of it and see the text) but they were still smaller than the original plain-text.

                                                        1. 2

                                                          Lenovo QWERTY UK MODEL SK-8825. It costs less than $8 here, it’s pleasant to use and quite sturdy. I’m going to buy/build some ergonomic mechanical keyboard soon tho.

                                                          1. 1

                                                            imrsh based on mrsh might be something interesting in the future. It seems to be an attempt at replicating unmatched Fish interactive usage UX (zsh is not even close and bash’s UX is a joke) but in POSIX shell. I’d love to use something like that.

                                                            1. 4

                                                              fzf, cht, fd, ripgrep, teip, batch, lf, kakoune in filter mode (kak -f), z.lua, lazygit

                                                              For K8s: stern is must-have.

                                                              1. 1

                                                                https://github.com/ajeetdsouza/zoxide feels way easier to implement than z.lua

                                                                1. 1

                                                                  dunno how it’s easier than cloning the repo and adding one line of config to my shell but whatever works for you :)

                                                              1. 7

                                                                „Police in my country is shit so let’s rename this project (used by people from all around the world).”

                                                                Honestly If I was bbatsov I’d permaban author of the isssue and anyone who upvoted it. They apparently don’t think reasonably. It’s waste of time to discuss with people who think newspeak will fix anything.

                                                                1. 2

                                                                  Banning people for a single disgression (if you want to call it that way) is disingenious. There have been similar discussions about naming in projects started by core team members or years-long contributors. And even if you don’t call it disgression but simply “having an opinion” there’s no need to ban them unless they start getting impolite. And when I read the linked issue even the “change the name”-people were maybe upset, but not aggressive or banworthy (for the most part).

                                                                1. 7

                                                                  When it comes to blocking ads, I go all the way: uBlock Origin with all the bells and whistles activated, cookie-blocker, cookie-consent-blocker, privacy badger, cookie autodelete, etc., but most importantly, SponsorBlock, where a community of enthusiasts identifies sponsor clips in youtube-videos, marks them and auto-skips them for everybody else. If you think that these sponsors take long to get “detected”, you’re wrong: I’ve not seen a single sponsor since I’ve been using it, even on videos only a few minutes (!) old.

                                                                  Sponsors are getting increasingly annoying and widespread on YouTube. I don’t think that content should be free, and youtubers need a way to monetize their videos, but using ad blocking technology might push them to much saner models like Patreon.

                                                                  I see it like this: Every ad-served user wastes a set amount of time and is annoyed, but only contributes like 0.001€ per view. If only one in 5000 viewers is a regular supporter on patreon with 5€/video (which is not uncommon), the youtuber gets the same amount of reward and everyone benefits from it. The patreon supporter gets a few perks on top, but most importantly, no one has to sit through ads. Another thing is, that since the adpocalypse on YouTube, the YouTubers are getting demonetized for even little things. And those ad-friendly-guidelines will get stricter and stricter. Going away from ad-revenue will not only bring benefits to the viewers, it will also bring back independence to the videomakers.

                                                                  Some people blame me for blocking ads, but I just can’t be arsed to sit through them. Every time I use another person’s phone, it really shocks me how bad ads on the internet have become. Those people using iDevices can’t even install ad blockers, which shows how bad a walled garden can harm your experience.

                                                                  1. 8

                                                                    I probably won’t install SponsorBlock.

                                                                    The main reason is that most of the arguments I made against ad blocking don’t apply here. Sponsored video clips are unlikely to exploit vulnerabilities (the video creator, and likely the video host, have reencoded the clip they were provided, so any malformed video is probably gone by now). They can’t track you, since they cannot make any outgoing web requests, and they cannot change after the video has been produced. And because they’re unable up change after the video is put out, they’re also unlikely to link to fly-by-night malware operations; starting from scratch as a direct video sponsor is too much work.

                                                                    They’re still annoying, but I’m sorry, the time and effort it takes to install and configure an ad blocker takes too much work just for a minute or two per video.

                                                                      1. 4

                                                                        It’s not as simple as a five minute initial setup. Ad blockers incur a variety of other costs:

                                                                        • I’m not nearly smart enough to make good points on capitalism in general, but I know people who see ad blocker as a moral hazard. I do have to justify myself to others.

                                                                        • Ad lists aren’t 100% reliable. There’s the risk of someone inserting a “sponsor segment” that messes up the video, either because they disagree on what constitutes a sponsor segment (does product placement count?) or because they’re just trolling.

                                                                        • If I switch browser, I need to re-install the add-on.

                                                                        • If the browser upgrades, the add-on might break.

                                                                        • If the video website upgrades, the add-on might break it.

                                                                        • The add-on might be compromised. Ask about the Stylish incident.

                                                                        Clearly worth it for the script-carrying ad networks (I am not going to take on a security hazard just up prop up your business), but not so obvious for video sponsors.

                                                                    1. 2

                                                                      Thank you for this, I never heard about SponsorBlock and I already love it!

                                                                      1. 1

                                                                        If only one in 5000 viewers is a regular supporter on patreon with 5€/video (which is not uncommon), the youtuber gets the same amount of reward and everyone benefits from it. The patreon supporter gets a few perks on top, but most importantly, no one has to sit through ads.

                                                                        This is a great point. This is a really good article on that topic by Tim Carmody.

                                                                        Those people using iDevices can’t even install ad blockers

                                                                        This isn’t really true: iOS has supported ad blockers (“content blockers”) since September 2015. Granted, these are only used for web content—they’re active in Safari and in all embedded web views but they can’t apply restrictions to non–web view content in apps. Overall, though, I don’t think it’s fair to say that iOS doesn’t support ad blockers.

                                                                      1. 3

                                                                        I wonder if similar process will ever happen to my huge Kakoune config (currently ~600 LOC excluding plugins)…