Threads for willjp

  1. 3

    Mediawiki for me. Sphinx for local-only work notes.

    I wrote my own thing for todos, but for work I think I could have gotten away with vim-journal or a custom syntaxhighlight file.

    1. 2

      It is appealing how little shellscripts change vs other languages, and it is useful for bootstrapping servers when python may not be installed yet. I don’t have update/packaging nightmares with shellscript. Will I still be heavily using python in 10 years? I’m not sure.

      Posix compliance and deviations are a nightmare though. If it’s a complex script, another tool is more appropriate.

      1. 3

        Related to the OP’s favourite — batch renaming!

        :r !ls /foo/bar-*/*.txt

        :%s/.*/mv “&” “&”/

        Now use vim to manipulate dest path

        :w !sh

        1. 2

          I love it, this is exactly how I take personal notes. It is simpler than the source (which may expand in complexity) is more efficient at communicating than a blog post, and is still searcheable.

          How would you feel about breaking it into multiple code blocks? It might make it easier to visually skim the text (although at the cost of the ability to run it as a script).

          1. 1

            My thinking was that the headings mark the sections. Like this one …

            # ===================
            # Let's use templates
            # ===================
            

            … marking the section about how to introduce templates.

            Maybe I should remove the “Yay” thingies like this one …

            # ♥=♥=♥=♥=♥=♥=♥=♥=♥=♥=♥=♥=♥
            # Yay, we have static site!
            # ♥=♥=♥=♥=♥=♥=♥=♥=♥=♥=♥=♥=♥
            

            … because it looks too much like a heading?

            Update: I deleted the heart framed YAYs now. I think it makes it more clear what the sections of the script are.

            1. 1

              That works! I’m just thinking aloud.

          1. 3

            I also wish apple would stop soldering at least ram and hard drives.

            I understand this is a vendor lockin strategy, a blow that is softened by the trade-in program. I also trust they more efficiently breakdown/recycle parts. It still feels wasteful as a consumer to invest 2000$ only to have it limited to the lifespan of an SSD.

            1. 2

              It is more about making more compact hardware and not needing to deal with users complaints about degraded performance when someone replace the provided hardware with something that is not compatible/not performant enough.

              1. 5

                Has any user, ever, on any system, complained about degraded performance when they themselves choose to replace parts, and then blame their slow disk speed on the original vendor rather than on their new disk?

                Because I’ve never heard of that happening at all. And if you’re concerned about that you might as well be concerned about people hitting their screen with a hammer and then complain that Apple makes screens with annoying broken glass and stuck lines of pixels.

                1. 1

                  Considering how fast SSDs Apple put in their machines, I think many users who installed a normal consumer-grade SSD in their Macs would complain about it being slow, without realising the cause.

                  That doesn’t imply I like the fact that they’re soldered down; ideally Apple should sell Apple-certified replacements.

            1. 15

              You lost me at “the great work from homebrew”

              Ignoring UNIX security best practices of the last. I dunno, 30, 40 years, and then actively preventing people from using the tool in any fashion that might be more secure, and refusing to acknowledge any such concerns is hardly “great work”.

              I could go on about their abysmal dependency resolution logic, but really if the security shit show wasn’t enough to convince you, the other failings won’t either.

              But also - suggesting Apple ship a first party container management tool because “other solutions use a VM”, suggests that either you think a lot of people want macOS containers (I’m pretty sure they don’t) or that you don’t understand what a container is/how it works.

              The “WSL is great because now I don’t need a VM” is either ridiculously good sarcasm, or yet again, evidence that you don’t know how something works. (For those unaware, WSL2 is just a VM. Yes it’s prettied up to make it more seamless, but it’s a VM.).

              1. 23

                I don’t know what’s SO wrong about Homebrew that every time it’s mentioned someone has to come and say that it sucks.

                For the use case of a personal computer, Homebrew is great. The packages are simple, it’s possible and easy to install packages locally (I install mine in ~/.Homebrew) and all my dependencies are always up to date. What would a « proper » package manager do better than Homebrew that I care about? Be specific please because I have no idea what you’re talking about in terms of security « shit show » or « abysmal » dependency resolution.

                1. 12
                  • A proper package manager wouldn’t allow unauthenticated installs into a global (from a $PATH perspective) location.
                  • A proper package manager wouldn’t actively prevent the user from removing the “WTF DILIGAF” permissions Homebrew sets and requiring authenticated installs.
                  • A proper package manager that has some form of “install binaries from source” would support and actively encourage building as an untrusted user, and requiring authentication to install.
                  • A proper package manager would resolve dynamic dependencies at install time not at build time.
                  • A proper open source community wouldn’t close down any conversation that dares to criticise their shit.
                  1. 11

                    Literally none of those things have ever had any impact on me after what, like a decade of using Homebrew? I’m sorry if you’ve run into problems in the past, but it’s never a good idea to project your experience onto an entire community of people. That way lies frustration.

                    1. 5

                      Who knew that people would have different experiences using software.

                      it’s never a good idea to project your experience onto an entire community of people

                      You should take your own advice. The things I stated are objective facts. I didn’t comment on how they will affect you as an individual, I stated what the core underlying issue is.

                      1. 6

                        You summarized your opinion on “proper” package managers and presented it as an authoritative standpoint. I don’t see objectiveness anywhere.

                    2. 3

                      I don’t really understand the fuss about point 1. The vast majority of developer machines are single user systems. If an attacker manages to get into the user account it barely matters if they can or cannot install packages since they can already read your bank passwords, SSH keys and so on. Mandatory relevant xkcd.

                      Surely, having the package manager require root to install packages would be useful in many scenarios but most users of Homebrew rightfully don’t care.

                    3. 8

                      As an occasional Python developer, I dislike that Homebrew breaks old versions of Python, including old virtualenvs, when a new version comes out. I get that the system is designed to always get you the latest version of stuff and have it all work together, but in the case of Python, Node, Ruby, etc. it should really be designed that it gets you the latest point releases, but leaves the 3.X versions to be installed side by side, since too much breaks from 3.6 to 3.7 or whatever.

                      1. 8

                        In my opinion for languages that can break between minor releases you should use a version manager (python seems to have pyenv). That’s what I do with node: I use Homebrew to install nvm and I use nvm to manage my node versions. For Go in comparison I just use the latest version from Homebrew because I know their goal is retro compatibility.

                        1. 5

                          Yeah, I eventually switched to Pyenv, but like, why? Homebrew is a package manager. Pyenv is a package manager… just for Python. Why can’t homebrew just do this for me instead of requiring me to use another tool?

                          1. 1

                            Or you could use asdf for managing python and node.

                          2. 7

                            FWIW I treat Homebrew’s Python as a dependency for other apps installed via Homebrew. I avoid using it for my own projects. I can’t speak on behalf of Homebrew officially, but that’s generally how Homebrew treats the compilers and runtimes. That is, you can use what Homebrew installs if you’re willing to accept that Homebrew is a rolling package manager that strives always to be up-to-date with the latest releases.

                            If you’re building software that needs to support a version of Python that is not Homebrew’s favored version, you’re best off using pyenv with brew install pyenv or a similar tool. Getting my teams at work off of brewed Python and onto pyenv-managed Python was a short work that’s saved a good bit of troubleshooting time.

                            1. 2

                              This is how I have started treating Homebrew as well, but I wish it were different and suitable for use as pyenv replacement.

                              1. 2

                                asdf is another decent option too.

                              2. 5

                                I’m a Python developer, and I use virtual environments, and I use Homebrew, and I understand how this could theoretically happen… yet I’ve literally never experienced it.

                                it should really be designed that it gets you the latest point releases, but leaves the 3.X versions to be installed side by side, since too much breaks from 3.6 to 3.7 or whatever.

                                Yep, that’s what it does. Install python@3.7 and you’ve got Python 3.7.x forever.

                                1. 1

                                  Maybe I’m just holding it wrong. :-/

                                2. 3

                                  I found this article helpful that was floating around a few months ago: https://justinmayer.com/posts/homebrew-python-is-not-for-you/

                                  I use macports btw where I have python 3.8, 3.9 and 3.10 installed side by side and it works reasonably well.

                                  For node I gave up (only need it for small things) and I use nvm now.

                                3. 8

                                  Homebrew is decent, but Nix for Darwin is usually available. There are in-depth comparisons between them, but in ten words or less: atomic upgrade and rollback; also, reproducibility by default.

                                  1. 9

                                    And Apple causes tons of grief for the Nix team every macOS release. It would be nice if they stopped doing that.

                                    1. 2

                                      I stopped using Nix on macOS after it is required to create an separate unencrypted volume just for Nix. Fortunately, NixOS works great on VM.

                                      1. 2

                                        It seems to work on an encrypted volume now at least!

                                  2. 4

                                    I really really hate how homebrew never ask me for confirmation. If I run brew upgrade it just does it. I have zero control over it.

                                    I come from zypper and dnf, which are both great examples of really good UX. I guess if all you know is homebrew or .dmg files, homebrew is amazing. Compared to other package managers, it might even be worse than winget….

                                    1. 2

                                      If I run brew upgrade it just does it

                                      … yeah? Can we agree that this is a weird criticism or is it just me?

                                    2. 2

                                      Overall I like it a lot and I’m very grateful brew exists. It’s smooth sailing the vast majority of the time.

                                      The only downside I get is: upgrades are not perfectly reliable. I’ve seen it break software on upgrades, with nasty dynamic linker errors.

                                      Aside from that it works great. IME it works very reliably if I install all the applications I want in one go from a clean slate and then don’t poke brew again.

                                    3. 4

                                      you think a lot of people want macOS containers (I’m pretty sure they don’t)

                                      I would LOVE macOS containers! Right now, in order to run a build on a macOS in CI I have to accept whatever the machine I’m given has installed (and the version of the OS) and just hope that’s good enough, or I have to script a bunch of install / configuration stuff (and I still can’t change the OS version) that has to run every single time.

                                      Basically, I’d love to be able to use macOS containers in the exact same way I use Linux containers for CI.

                                      1. 1

                                        Yes!!

                                        1. Headless macos would be wonderful
                                        2. Containers would be fantastic. Even without the docker-like incremental builds, something like FreeBSD jails or LXC containers would be very empowering for build environments, dev servers, etc
                                        1. 1

                                          Containers would be fantastic. Even without the docker-like incremental builds, something like FreeBSD jails or LXC containers would be very empowering for build environments, dev servers, etc

                                          These days, Docker (well, Moby) delegates to containerd for managing both isolation environments and image management.

                                          Docker originally used a union filesystem abstraction and tried to emulate that everywhere. Containerd provides a snapshot abstraction and tries to emulate that everywhere. This works a lot better because you can trivially implement snapshots with union mounts (each snapshot is a separate directory that you union mount on top of another one) but the converse is hard. APFS has ZFS-like snapshot support and so adding an APFS snapshotter to containerd is ‘just work’ - it doesn’t require anything else.

                                          If the OS provides a filesystem with snapshotting and a isolation mechanism then it’s relatively easy to add a containerd snapshotter and shim to use them (at least, in comparison with writing a container management system from scratch).

                                          Even without a shared-kernel virtualisation system, you could probably use xhyve[1] to run macOS VMs for each container. As far as I recall, the macOS EULA allows you to run as many macOS VMs on Apple hardware as you want.

                                          [1] xhyve is a port of FreeBSD’s bhyve to run on top of the XNU hypervisor framework, which is used by the Mac version of Docker to run Linux VMs.

                                      2. 2

                                        Ignoring which particular bits of Unix security practices is problematic? There are functionally no Macs in use today that are multi-user systems.

                                        1. 3

                                          All of my macs and my families macs are multi-user.

                                          1. 2

                                            The different services in OS are running as different users. It is in general good thing to run different services with minimal required privileges, different OS provided services run with different privileges, different Homebrew services run with different privileges, etc. So reducing the blast radius, even if there is only one human user is a pro, as there are often more users at once, just not all users are meatbags.

                                          2. 1

                                            I’ve been a homebrew user since my latest mac (2018) but my previous one (2011) I used macports, given you seem to have more of an understanding of what a package manager should do than I have, do you have any thoughts on macports?

                                            1. 4

                                              I believe MacPorts does a better job of things, but I can’t speak to it specifically, as I haven’t used it in a very long time.

                                              1. 1

                                                Thanks for the response, it does seem like it’s lost its popularity and I’m not quite sure why. I went with brew simply because it seemed to be what most articles/docs I looked at were using.

                                                1. 3

                                                  I went with brew simply because it seemed to be what most articles/docs I looked at were using.

                                                  Pretty much this reason. Homebrew came out when macports was still source-only installs and had some other subtle gotchas. Since then, those have been cleared up but homebrew had already snowballed into “it’s what my friends are all using”

                                                  I will always install MP on every Mac I use, but I’ve known I’ve been in the minority for quite awhile.

                                                  1. 1

                                                    Do you find the number of packages to be comparable to brew? I don’t have a good enough reason to switch but would potentially use it again when I get another mac in the future.

                                                    1. 3

                                                      I’ve usually been able to find something unless it’s extremely new, obscure, or has bulky dependencies like gtk/qt or specific versions of llvm/gcc. The other nice thing is that if the build is relatively standard, uses ‘configure’ or fits into an existing PortGroup, it’s usually pretty quick to whip up a local Portfile(which are TCL-based so it’s easy to copy a similar package config and modify to fit).

                                                      Disclaimer: I don’t work on web frontends so I usually don’t deal with node or JS/TS-specific tools.

                                                      1. 3

                                                        On MacPorts vs Homebrew I usually blame popularity first and irrational fear of the term ‘Ports’ as in “BSD Ports System”, second. On the second cause, a lot of people just don’t seem to know that what started off as a way to have ‘configure; make; make install’ more maintainable across multiple machines has turned into a binary package creation system. I don’t anything about Homebrew so I can’t comment there.

                                            1. 1

                                              IIRC, the workaround in this github issue got my VR dashboard working in steamvr. I’ve been struggling with this as well. I can’t remember if it affected the headset, but I’ve had more luck in general with proton games launching from floating window WMs than i3 (in my case openbox). This may have been a multimonitor issue though. Good Luck!!

                                              https://github.com/ValveSoftware/SteamVR-for-Linux/issues/255#issuecomment-877844004

                                              1. 2

                                                This is generally how I wake up. It is not my favourite thing at 4am when you need to go to the bathroom but then can’t return to sleep.

                                                1. 2

                                                  One more trick if you haven’t seen this yet - there is a builtin interactive session-selector in tmux! If your tmux prefix is alt-a, you can execute alt-a + s and you’ll get a list of all sessions, with previews of all panes/splits in that session.

                                                  1. 1

                                                    Hi there - thanks, yes - prefix s is something I use quite a lot and may continue to as well. As I mentioned in my post, the building of the menu-based session selector was more for learning about it rather than to replace anything. But I’m finding, at least for the “permanent” sessions that I have, where I know I want to switch regardless of what’s there, this simpler selector works quite well so far.