1. 3

    The lack of contrast in the code blocks makes it difficult to read.

    1. 7

      I’ve just pushed a change to improve contrast. I hope you’ll find it easier to read now!

    1. 2

      This is a great overview for those in the process of learning Rust

      1. 2

        I’ve been using this solution with a slight modification,. It is basically the same idea, but creates custom commands instead of modifying CDPATH.

        1. 16

          Regarding this comment on your website:

          My goto style when dealing with python dictionaries. In my latest one, I was building a dictionary of lists: try dict[k].append(element), except dict[k] = [element]. Glad to know the EAFP fancy name that I can throw around my peers. And thanks for the good insights on the performance cuts this approach entails.

          Use a defaultdict. If the key does not exist it defaults to a given type.

          from collections import defaultdict
          
          dict_of_list = defaultdict(list)
          dict_of_list[key].append(element)
          

          It is more readable and faster!

          1. 8

            Or setdefault method for the dict built-in: d.setdefault(key, []).append(element)

            1. 5

              That causes the python vm to build a new empty list for each element, and make two function calls instead of one. This adds up when looping, and may fragment the heap.

              >>> import dis
              >>> def asd(): return d.setdefault(key, []).append(element)
              >>> dis.dis(asd)
                1           0 LOAD_GLOBAL              0 (d)
                            2 LOAD_METHOD              1 (setdefault)
                            4 LOAD_GLOBAL              2 (key)
                            6 BUILD_LIST               0
                            8 CALL_METHOD              2
                           10 LOAD_METHOD              3 (append)
                           12 LOAD_GLOBAL              4 (element)
                           14 CALL_METHOD              1
                           16 RETURN_VALUE
              >>> def asd(): return d[key].append(element)
              >>> dis.dis(asd)
                1           0 LOAD_GLOBAL              0 (d)
                            2 LOAD_GLOBAL              1 (key)
                            4 BINARY_SUBSCR
                            6 LOAD_METHOD              2 (append)
                            8 LOAD_GLOBAL              3 (element)
                           10 CALL_METHOD              1
                           12 RETURN_VALUE
              

              I believe the defaultdict simply overrides the __missing__ method of dict, effectively making it a ‘ask for forgiveness’ implementation.

          1. 2

            I would love it if some project installed lots of tools like this globally. This looks like a pretty neat way of installing it, but I’d like support for more than just images. Support for diffing all documents supported by pandoc would be nice. Sqlite3 databases also.

            1. 2

              This is a change log. You can’t really call this a progress report like with Dolphin, Citra, Yuzu, RPCS3, melonDS, etc…

              1. 1

                I use the one thing tdd gets right: I design my program how I as a user would want to use it. This make me abstract the problem into nice-to-use tools first and foremost

                1. 1

                  Is sublime able to live-preview markdown via pandoc? Support for math, preferably via a fast engine like katex, would be a godsend.

                  1. 2

                    No, it only displays text, so no webviews for previews.

                    1. 5

                      That’s false. Sublime Text has been able to show HTML snippets using the phantoms functionality for years:

                      https://www.sublimetext.com/docs/3/api_reference.html#sublime.Phantom

                      E.g. the LaTeXTools uses phantoms to preview equations and images:

                      https://latextools.readthedocs.io/en/latest/features/#previewing

                      (Not a Sublime Text user, but I did use Sublime sometimes years ago and used this functionality a bit for editing LaTeX.)

                  1. 9

                    F-droid may finally get used more often

                    1. 10

                      F-Droid with the privileged extension is pretty nice, but the effort to install the privileged extension really only makes sense if you’re using a custom Android version. That said, it seems incredibly difficult to get security updates into F-Droid (I’ve never tried, but I’ve had app developers recommend that I get the build of their open-source app from the Play store because they struggle to get timely updates into F-Droid). The thing I’d love to see is GitHub adding F-Droid repo to their set of supported repo types for generated artefacts. That would make it trivial for any open-source Android app (or in-house Android app on a private GitHub repo or GitHub Enterprice thing) to have a complete development to deployment process bypassing Google.

                    1. 3

                      Linus is not only an amazing developer, but he’s also an amazing musician. This is my favorite work of his.

                      1. 5

                        My understanding is that USB-PD basically contains an Ethernet-like protocol to send digital information between microprocessors in the USB/charging circuits of the two devices (charger and Switch, power bank and phone, etc), and the two sides speak a fairly complicated protocol with quite complicated state machines.

                        Seems completely bonkers over-engineered to me, I’m not surprised at all that devices get USB-PD all kinds of wrong, especially when most of these kinds of chips are going to be produced as cheaply as possible by white-label companies which will put in exactly enough effort to make money. But what do I know.

                        EDIT: Here’s an article I found which seems to explain the protocol fairly understandably: https://www.embedded.com/usb-type-c-and-power-delivery-101-power-delivery-protocol/

                        1. 9

                          I just wanna point out that this complicated protocol is a protocol which, in >99.9% of cases, will be used to select between 5V, 9V, 12V, 15V or 20V. I feel like this could’ve been done simpler.

                          1. 7

                            It can. USB-C picked a handful of resister values that can be used to negotiate power without requiring an additional protocol on top. This was critical for adoption because a lot of cheap chargers are sold so close to cost that adding a microcontroller to the BOM would push them over the top.

                            1. 1

                              Thanks, that’s an important correction.

                              Do you have a link to a document which describes it? Everything I’m able to find on USB-C PD just describes the digital protocol over 1-wire, but I haven’t read the spec.

                              1. 1

                                I went to a great talk about this and I’m completely blanking on the name of the speaker and the title of the talk. The spec describes the pull-up resistors needed to assert that you can deliver / consume the higher power mode. I think you need USB-PD for the very high power modes, but the fast-charge mode is activated with just a handful of resistors between the PSU and the device.

                            2. 1

                              The M1 macs use USB-C PD as a serial port early in the boot process I believe.

                          1. 24

                            “If you don’t trust us, just review the 12345 line install script we copy-and-pasted from 20 SO questions.”

                            1. 9

                              I recently saw one of these (for a VMware CLI) that consisted of a tar file, wrapped inside a shell script. The script looks for a marker ####ARCHIVE_BEGINS---, uses awk to write the inlined binary data to its own file and then extracts it and continues installing. Good luck reviewing that!

                              Apparently this is not uncommon, but was new to me - at least as a trick anyone would use for production distribution of a professional product. I still can’t quite work out why they bothered as obtaining the script requires a login and a lot of JavaScript, making it difficult to curl | sudo bash anyway.

                              1. 7

                                For those interested: https://makeself.io

                                1. 2

                                  Makeself is a great tool for what it is! I believe if it advertised itself more in its own output, there would be fewer custom installation scripts.

                                2. 6

                                  Something like this, https://github.com/megastep/makeself ?

                                  It used to be simple. Something like https://cgit.freebsd.org/src/tree/usr.bin/shar/shar.sh

                                  1. 3

                                    I’ve seen it in installers going back to at least the early 00s and it’s probably a lot older than that. I think in Linux binaries of some video games and ATI graphics drivers.

                                    The common thing I’ve seen is using awk or something to find the offset of the marker, then dd or head to make a copy with it stripped off?

                                    1. 4

                                      I remember the ones that Loki games used in the late 90s/early 00s. They were shell archives, and when bash 4 came out it broke them all.

                                1. 1

                                  A proper apology admitting to their wrong doings. Refreshing to see in this day and age.

                                  1. 2

                                    Why would it matter? In open source software, if you care enough about something, you can just make it happen. If there is a mismatch between what you need and what you have, either you do as every person does and craft a workaround, or you shop for a better solution, or you fix it yourself.

                                    There is no sense in even acknowledging the gap between what a volunteer written program does and what professionals need it to do. If professionals actually needed a change, they have full ability to volunteer as well.

                                    1. 3

                                      If the original author or maintainer has become inactive, then it can be difficult getting your changes merged upstream so others may benefit. I have a few stale PRs left hanging on Github for this reason. Most developers have an aversion to forking a project. It does happen (see htop), but it is rare.

                                      It is possible to maintain a set of patches on top of upstream code, like the packages some distributions provide (e.g. BSD Ports and Debian-like security backports), but this does not scale as well as merging upstream would.

                                      Is i understand the abstract, this is a method to identify which project could use some more love. Initiatives like hacktoberfest and the generous work of redhat and debian does could be better focused by employing such a technique. These may also be some sexy numbers to show to your boss if you want to argue for time dedicated to opensource work. “It’s not philanthropy, it’s risk mitigation”

                                      1. 2

                                        There are many non-professional users, who don’t have ability to volunteer. At the end of the day, open source is for users, it is all for naught if it doesn’t benefit users. Since you are a professional, you are absolutely right if you focus on your own use (selfish motivation) of open source. Underproduction means many users rely on the software but not many developers work on the software. It is relevant if you want to know where the help is most needed to improve user’s use (altruistic motivation) of open source.

                                      1. 23

                                        i think the most effective thing linux laptop producers could do to increase adoption is to improve the touchpad drivers and make it as nice an experience as Mac. As a non power user of the Mac specific software this was the biggest downside of other laptops I have tried.

                                        1. 5

                                          I second this, I use a Mac at work and an xps13 otherwise and this frustrates me so much.

                                          The second point is wifi and Bluetooth stability that is completely unreliable compared to macOS…

                                          1. -2

                                            You use a touchpad when you’re at work?

                                            1. 13

                                              questions like this make me not want to participate in this website.

                                              1. 3

                                                I use a Magic Trackpad on my stationary computer. It’s better for everything except precision pixel painting, especially for your body.

                                                1. 3

                                                  Not the parent poster, but yes. I do a modest percentage of my work using a laptop as a laptop.

                                                  In pre-pandemic times, I had frequent in person meetings. In pandemic times, I sometimes have to be where I can see/hear the kids.

                                                  With a Mac, I just use the trackpad. It’s not something I’d do 8 hours a day, but I have zero problems using it when I’m mobile. On linux, I either schlep around a mouse, which is inconvenient, or use the trackpad, which is also frustrating.

                                                  1. 2

                                                    Many prefer to cyble between multiple mouse inputs to combat carpal tunnel and other strain related injuries. I much prefer a touch pad myself.

                                              1. 2

                                                A nice use of SDFs. I wonder about some sort of regularization or constraint on the outputs from training, because SDFs should be continuous, which induces a triangle inequality on every pixel relative to the implicit edge of the font. Edit: After spending a few minutes at the whiteboard, I think that the inequality is on every pair of pixels, and might only be useful for pixels whose values in the field have different signs.

                                                1. 2

                                                  Valid SDFs have a spatial derivative with an amplitude of 1: The square of the x and y gradients should add up to 1. SDFs are a special case of eikonal equations.

                                                1. 1

                                                  I just have my makefiles run commands in the venv using poetry-run

                                                  1. 1

                                                    The current activities overview is the major reason I use GNOME. I must say I am skeptical to these changes. Hopefully Gnome Tweaks lets me use the old key combinations and have vertically scrolling workspaces.

                                                    1. 2

                                                      If not you can always use KDE and tweak its activities overview as you like

                                                      1. 1

                                                        I’m still super sad that RedHat and Canonical chose Gnome, and I wish I could have been a fly on the wall when those discussions happened.

                                                        Bet you dollars for donuts they were scared away by Qt’s licensing.

                                                        Meanwhile I’m running Kubuntu 21.04 on my laptop and it runs like a champ and has the accessibility features I need. Yay KDE!

                                                    1. 2

                                                      I moved off of LastPass because of their switch to one device, but I ended up going with Myki. I like that it doesn’t store my info on their servers and it has a seamless LastPass import. Pass is a bit of a primitive/too much DIY for what I want, but it seems like a decent option.

                                                      1. 1

                                                        Does Myki support running a headless client on say a NAS to ensure passwords are always synced?

                                                      1. 4

                                                        Incredibly well written and understandable to us mortals with little to no preexisting knowledge of these tiny embedded fiddly bits. I already knew when Marcan announced that he would work on the M1 on Twitter that this would result in lots of good reads going forward. I don’t even use OSX and I still want to support his patreon simply because of the amazing writeups and discoveries he does.