Threads for napkindrawing

    1. 7

      The others have varying degrees of being specific to a use case, but:

      Count the Number of Words in a File

      You can actually use g<C-g> for that!

      1. 4

        I was going to suggest :w !wc -w, which is still useful bc g<C-g> isn’t bound in Evil’s defaults. The :w !<Cmd> syntax (which TIL doesn’t save before running the command, but diverts the write into the pipe) also generalizes well into other use-cases.

        1. 2

          I was about to comment that one could also use M-x count-words when using evil, and saw that it’s bound to g C-g in doom emacs :)

        2. 1

          TIL :w !<cmd> I’m gonna look this up in the help for myself after asking, but what’s the difference between :%!foo and w !<cmd>

          1. 2

            :%!foo replaces the entire buffer with the output of piping the buffer contents to foo.

            :w !foo just pipes the buffer contents to foo and displays the output, leaving the buffer unchanged.

    2. 29

      There is a “GOTO” keyword, but instead of something as prosaic as affecting the internal control flow of the program, its argument is in fact an IP address, and denotes that execution of the program immediately moves from the current machine to the indicated machine.

      1. 18

        This of course is mirrored by its sister keyword COMEFROM which, thanks to the distributed nature of GOTO, can redirect any currently executing code on a remote server to be halted and resumed locally.

      2. 3

        Ah, this is a feature in General Magic’s programming language Telescript.

    3. 1

      I am not intelligent enough to understand this.

      If anyone else does, could they explain it to me?

      1. 1

        Because Math, you can write a programming language that is programmed only with:

        • One integer
        • A list of fractions

        It is computationally equivalent (can do the same things) as most programming languages you’re familiar with.

        1. 1

          Because Math,

          I am going to remember that and use it in the future.

    4. 5

      There’s a jc web demo that allows pasting in any text and selecting a filter to see how the data is parsed.

      There’s also a jc Ansible filter as well that allows simply parsing structured data from remote command output.

      Pretty neat!

      - name: Get Timezone
        hosts: ubuntu
        tasks:
        - shell: date
          register: result
        - set_fact:
            myvar: "{{ result.stdout | community.general.jc('date') }}"
        - debug:
            msg: "The timezone is: {{ myvar.timezone }}"
      
    5. 1

      Clipboard history is also one of the great features of Alfred which I’ve been using for years. It also integrates well with Alfred Snippets so you have fast access to commonly used text-related things.

    6. 3

      I recently went through most of this agony trying to get a RockPro64 to work with OpenBSD and a PCIe NIC, and I was ultimately unsuccessful. Super frustrating.

      1. 2

        PCIe on the rockpro64 is a lot less coherent than on amd64 systems, so drivers that don’t do dma syncs correctly will have problems. I recently fixed aq(4) so it works properly on rockpro64, though I haven’t committed some of that work yet. Which nic/driver were you using?

        1. 1

          It’s a dual-port Intel 82576

          1. 2

            I’m not sure if you’re still interested in having this work, but I posted a diff here:

            https://marc.info/?l=openbsd-tech&m=165645184229510&w=2

            this hasn’t been committed yet, it’s a bit of a hack and we still need to figure out how much of it we should do properly instead.

    7. 1

      The whole arm board/SoC thing is a mess now. I guess we need a powerhouse of the IBM in the early PC era.

      1. 5

        https://tow-boot.org/ does that. The recommended installation approach is to install that to your board’s SPI, which can then boot generic arm64 images.

        It’s used by ~most Linux mobile distributions, and allows the distributions to publish a single arm64 image.

        1. 2

          Oh tow-boot looks really good thank you for the link!

          1. 2

            It doesn’t support Rock64 yet, but the developer recently suggested it wouldn’t be much work, and they’d give it go, if others could help verify it: https://github.com/Tow-Boot/Tow-Boot/issues/151

            Consider offering to verify, if you’re keen!

    8. 3

      I’ve always felt SELinux was a gamble, because outside of 100% streamlined vendor distributions, with only vendor-supplied packages installed, there would just be too much friction to maintain a functional setup.

      I wish OpenBSD-style pledge and unveil capabilities APIs were more popular. That way it’s the software itself saying: “OK, given my startup configuration, I only need X, Y and Z, and I only need access to these files and these directories, please ban me from everything else!”

      1. 5

        I hope Linux Landlock may provide such sandboxing capabilities like pledge or unveil in the future.

        1. 2

          I wasn’t aware of Linux Landlock, so thanks for sharing!

          Under long-term goals: “add the ability to create (file descriptor) capabilities compatible with Capsicum.”

          YAY! :) I’m glad the author didn’t get stuck in NIH(where lots of Linux stuff seems to end up), and thought about the other stuff out in the world that already do this, like capsicum.

        2. 1

          Also adopting things like Rust in kernel and essential modules, where things like capabilities are built-in, should pull in that direction and eventually help with it.

          1. 1

            rust has capabilities built in?

    9. 2

      Straightforward introduction, but it makes me nervous that there’s still only one User type, so the type system would happily allow inserting an unencrypted User into the database. I’d feel much safer with UserPlaintext and UserEncrypted structs to design my APIs around.

      1. 2

        Yeah, I don’t think this problem really fits with generics at all. I would write a function EncryptFields(s any) and then in User, have a MarshalJSON method that copies the user, calls EncryptFields on the copy, and then calls json.Marshall with a method-less type plainUser User like json.Marshal((*plainUser)(&encryptedUser)).

    10. 2

      What a wonderful, accurate, and relaxing video.

    11. 2

      Oh my goodness, how have I never run across this timing-diagram editor tool before 😍

      You can jump to the actual code that implements the above algorithm, but I prefer to think about implementations visually. Thus, I created this timing diagram that fully encapsulates all of the above steps, and the data movements between each part (click on the image for an editable, larger version; works best on desktop): (Image) Interactive Timing Diagram Editor View

    12. 2

      Previous: https://lobste.rs/s/3kcqtu/php_8_before_after

      (looks like the URL changed, so it didn’t get detected).

      1. 2

        Ah, that post is comparing PHP 7.4 with the (then) newly released 8.0, this post is comparing 8.0 to 8.1.

        1. 2

          Oh wait, I missed that 🤦

    13. 5

      A table of contents would be fantastic. There’s a lot of helpful examples in here but you have to run through the whole slide deck to get to them.

      1. 1

        This time, a single page with a nav will do the job. Thank you very much for your suggestion, I appreciate!

    14. 1

      Company: Carbonhouse

      Company site: https://www.carbonhouse.com/

      Position(s): Web Designer

      Location: Charlotte, NC / Remote / Hybrid

      Description:

      • Craft responsive and accessible websites for the entertainment and sports industries
      • Deliver strategic and consistent end-to-end experience for users
      • Influence the design and directions of the projects you work on
      • Work collaboratively with developers to execute design vision
      • Design according to requirements documentation
      • Follow client brand guidelines and modifying these guidelines when appropriate

      Tech stack: CSS, JS, PHP, FreeBSD

      Contact: https://www.carbonhouse.com/careers/web-designer/

    15. 2

      See their paper on BullFrog:

      BullFrog: Online Schema Evolution via Lazy Evaluation. Souvik Bhattacherjee, Gang Liao, Michael Hicks, and Daniel J. Abadi. In Proceedings of the ACM SIGMOD International Conference on Management of Data (SIGMOD), June 2021.

      Also, nice that they just built this on top of PostgreSQL:

      We implemented a complete prototype of BullFrog on top of PostgreSQL 11.0. Our implementation leverages PostgreSQL’s existing view expansion and query rewriting/optimization functionalities – we did not have to modify any core PostgreSQL code. Our bitmap data structures (see Section 3.3) use PostgreSQL’s existing TIDs for mapping tuples to bits in the bitmap.

    16. 2

      debugger: on_failed

      Ugggh how did I not know about Ansible having a built-in interactive debugger