Threads for raymii

  1. 2

    I often use Sublime Merge to reword commits (edit commit message), or to split up commits (it undoes the commit and you get everything in the working directory), so I’m not sure if this table is entirely correct. (At least from a user point of view I can easily edit or reword).

    One other nice feature is the squashing of two commits, ignoring the latters message (as a fixup). Not sure how to do that in one click or command with cli git…

    1. 1

      Can you reword/split commits without having them checked out, or without touching the working directory? That’s what these criteria are about, and from your description, it doesn’t sound like you can do those directly in Sublime Merge.

      1. 1

        The specific issue was already answered on the orange site, thanks for your comment there. Side note, I saw an interactive comment inside the article. That inline comment and the ability to select and then comment looks amazing, could you please elaborate on that a bit? How does that work, or what is the software called you use? I see discuss, but the inline comment links to GitHub?

        1. 1

          It’s custom. I’ve written this blog post for you: https://blog.waleedkhan.name/interactive-blogs/

          1. 1

            This is neat, thank you!

    1. 5

      I sometimes miss a ‘sysadmin’ tag on here. Often such articles get shoehorned into Windows, Linux or DevOps, when a sysadmin tag would give more context.

      1. 3

        Can probably be just a comment here: https://lobste.rs/s/ii98um/why_i_still_have_old_school_cert_on_my_https , no need for a new post.

        1. 1

          I appreciate the blog post.

          If that blog post appeared as a comment on that (really great) thread, I wouldn’t have read farther than the first two sentences.

        1. 12

          I agree with almost all of these, but not std::array. It has two advantages over raw C arrays. First, it is bounds checked (related, use .at() instead of []) and the bounds are part of the type system and so you can get hard compile failures if you pass the wrong sized array as a function argument. Second, it has a .size(), which is very useful for code review of interop with C: any C function that takes a C array should be passed the result of calling .data() and .size() on some C++ type. If it is passed anything else, think very hard about security in code review. If it is passed both of those, nod and move on.

          1. 6

            Yes, and std::array is a value type, whereas C arrays are basically raw pointers except in some cases that I honestly don’t remember the rules of. So, as you pointed out, they’re nearly useless as function parameters. Thus the C idiom of a struct wrapped around an array just to give it value semantics and size-checking.

            std::array is much better. I do not understand the examples given of why it’s bad; what’s wrong with them?

            1. 7

              Unrelated to this topic but you two are the reason I submit most of the c++ tagged stuff, next to liking it myself and working professionally with it. Comments are often so insightful and I learn from them. Thanks both David and Jens.

              1. 0

                This is a great discussion, I just wish we weren’t promoting a registered sex offender’s content to get that discussion going.

                1. 1

                  It this a case of “once guilty, always guilty?” I see he was convicted and served his time 11 years ago. Is there no possible redemption?

              2. 2

                The annoying thing with std::array is that it isn’t an array. This means that all of the nice initialiser syntax borrowed from C does not work. For example, you can’t write initialisation with explicit source indexes. I suppose that would be fixable (ish) by adding a constructor to std::array that took an initialiser list of size_t and T pairs.

            1. 5

              This is the distro I run on most of my 2013 and below era hardware. Works perfectly, familiair Debian environment and extremely low on resource usage. Includes multiple desktops and, because it’s Debian based, I can just install KDE if I want.

              1. 1

                This was already posted as a reply in this topic: https://lobste.rs/s/quywfp/yagni_exceptions#c_fwijse

                1. 4

                  I editorialised the title to highlight the, IMHO, biggest announcement of the whole piece.

                  1. 3

                    Not sure if you can use the story description to promote the content, @pushcx? (Reason: Please don’t use the story text to write comments.). The below linked reddit thread also goes in to a bit of self-promotion suggestion that the repository has bought stars / forks.

                    Quiting a reddit comment: https://www.reddit.com/r/cpp/comments/xxoz29/coost_a_fantastic_c_library/

                    FriendlyRollOfSushi - 3 hr. ago

                    Holy Bjarne on a bicycle.

                    There is this amusing trend that codebases where everything is named “fast” are often the slowest ones by far, ones where everything is “safe” tend to barely work at all, etc. Looks like this library is no exception. I looked at one class and its parents so far, and it was one heck of a ride:

                    • fastring. Okay, a bit foreshadowing…

                    • No SSO in any way, shape, or form, because who needs performance anyway? We named it fast, it should be enough, right?

                    • Crashes on self-appends. But that’s okay, it’s named fast, not working.

                    • No asserts anywhere where you typically expect them, like front() etc. I guess the user is expected to call god::bless_no_bugs(); a few more times instead if they want to debug anything.

                    • safe_clear(), just like the naming convention suggests, won’t do it’s only job if the compiler figures out that we are about to deallocate the memory (I didn’t check whether deallocation is currently obfuscated enough to avoid optimizing memset out). Stuff like SecureZeroMemory exists for a reason.

                    • resize() doesn’t clear the memory if the size was increased. 0 lines of documentation to note this anywhere. Okay.

                    • ensure() potentially overflows in if (_cap < _size + n), because of course it does. We have the invariant _size <= _cap, so if (_cap - _size < n) would work correctly and always be safe, and it’s neither longer nor slower, but, like… Sigh…

                    • Mutating c_str() that invalidates data(). What’s even funnier, is that the terminating zero counts against the capacity, so if you had 100 bytes of data, reserved for exactly 100 symbols, appended and called c_str(), it will reallocate. Presumably the way to avoid this is to sprinkle + 1 everywhere manually on the user’s side. I like how the file is named fast.h.

                    • What makes it absolutely hilarious is that find()/rfind() are also mutating and invalidating pointers (they call c_str() internally), potentially including the one you used for the search. I don’t even.

                    • operator= re-constructs the string in-place without destroying it first. The standard is probably like: “Am I a joke to you?”

                    • O(s.size()) cost of s == s for any fastring s. Gotta go fast.

                    • O(strlen(b)) cost of operator<(const fastring& a, const char* b) even against an empty a. This one is a bit of a nitpick, because who uses const char* in 2022 outside of the context of communicating with legacy APIs anyway.

                    Speaking of comparators. How on Earth did we end up with emitting two memcmp calls inside one operator< everywhere? I’m not even mad, that’s bloody impressive.

                    I don’t know if it’s a self-promotion post, but:

                    • If it’s not, please consider reviewing the code before advertising it as “fantastic”. Although it is fantastic in its own ways.

                    • If it is a self-promotion post, then, well, good luck. god::bless_no_bugs(); is funny, though, so kudos for that.

                    1. 2

                      I don’t know if it’s a self-promotion post, but:

                      It says ‘authored by’ in the submission and the github username of the project matches the submitter, so I’m fairly confident it is. The author has submitted six things here and three have been links to things that they’ve worked on, two have been a replies to comments on their submitted stories, only one has been about something that isn’t self promotion, so I’m going to lean towards spammer.

                      If it is a self-promotion post, then, well, good luck. god::bless_no_bugs(); is funny, though, so kudos for that.

                      I honestly thought that this was satire. The ‘god mode’ bits looked like a joke, some of the rest of the code is astonishingly bad. I clicked on a few random files and each one had a WTF in the first place I randomly scrolled to.

                    1. 7

                      I’m a simple man, I see trains, I upvote.

                        1. 3

                          I have a script using slop and ffmpeg, https://raymii.org/s/snippets/Record_your_Linux_Desktop_with_ffmpeg_and_slop.html, but it creates huge files. This articles approach looks interesting because I’ve now mostly switched to Peek, which producesway smaller ffiles and can be resized to a specific window. https://github.com/phw/peek

                          1. 2

                            peek is very convenient, and it’s even in most distro’s repositories, I believe. Certainly on Fedora.

                            I like to output mp4s with it, even if it describes itself (in the repository) as:

                            peek.x86_64 : Animated GIF screen recorder with an easy to use interface

                          1. 0

                            Title is editorialised to highlight the specific doc part.

                            1. 4

                              It’s a more useful title than the original.

                            1. 4

                              Title was edited to be less clickbaity.

                              I dislike the syntax, seems to be just to make the parser easier instead of easier for the user (the programmer). Make the parser as complex as possible, but the language easy for the user. Programming languages, IMHO, are ment to be read, not written.

                              1. 9

                                I think there are two separate themes here:

                                • Is Carbon syntax easy for humans?
                                • Is making syntax easier for tools worth it?

                                For the first one, I am pretty sure that, for humans, Carbon is a marked improvement over C++. C syntax requires a special micro-skill for reading function types and cv-qualifiers, which is definitely not human friendly. Ability to ctrl+f for fn $identifier is also super helpful! It’s not clear if that’s the best we can do, but it seems good enough, and matches pretty closely the current dominant “ML with curly braces” style of Go, Swift, Kotlin and Rust.

                                The second one is a tradeoff. You can push extra complexity into compiler’s semantic analysis to make syntax easier, but it’s not free. There are three things you trade:

                                • Huge amount of implementation effort. I would estimate that it’d take a motivated intern a year to implement a Carbon language server which would run in circles around rust-analyzer in terms of both features and performance.
                                • Feedback loop length: complex features generally take more time to analyze, and time is perceivable by the human programmer. Some language features place a bound on how even a theoretically optimal compiler can be.
                                • Tolling features: certain features might become impossible depending on the language complexity. A good one is guaranteed correct automated refactors: the language might, or might not force you to use heuristics there!

                                Carbon is designed for huge codebases, and I would argue that, the larger the codebase, the more important the above points become. So, it seems to me that Carbon very deliberately prioritizes tooling-friendliness (api files would probably be the most contentious feature here). And they do a great job at it: at this point, and IDE for Carbon would be easy to implement, fast, and feature full. Hope they don’t mess this up when adding conditional compilation :-)

                                1. 2

                                  That’s just a question of taste. I much prefer the new syntax. It’s closer to rust, and, transitively, to the ML family. Ambiguities bite programmers too, so this makes it easier for everybody.

                                  Generally the syntaxes that look like rust/kotlin/scala/… (var x : type = expr etc.) are, imho, just better. It’s easy to omit the type when it can easily be inferred and feels redundant. It’s easy to see where a variable is first defined. It lends itself well to distinguishing mutable variables from immutable ones. I hope it keeps going in this direction.

                                  1. 2

                                    Easier for the parser or not, CDECL syntax is a dumpster fire, and drifting either in the MLish direction with trailing types or Modula-ish direction with keywords replacing a bunch of braces would be preferable for this code reader.

                                  1. 11

                                    Imagine your change log looking like this:

                                    better support for new Intel and AMD Zen 3 chipsets, […], support for wsfb-based X11 servers on the Commodore Amiga.

                                    I love netbsd, running on Alpha mostly, or sometimes x86.

                                    1. 8

                                      I have to admit taking a lot of pleasure in putting very old and very new things together like that when writing the NetBSD changelogs. ;)

                                    1. 24

                                      Can we have a snarky version, to replace n-gate.com?

                                      1. 38

                                        I tried few-shot training GPT-3 by copying 4-5 HN headlines and their n-gate summaries into the prompt. Then I pasted some headlines from HN’s frontpage today:


                                        Microsoft Windows is prohibited at Gitlab

                                        Gitlab (business model: “Uber for Git”) has decided that it will no longer support Microsoft Windows (business model: “Uber for proprietary software”). Hackernews, who have all been using Macs for the past ten years and have never even heard of Windows, are shocked and appalled that anyone would use such a terrible operating system. They spend the next few hours patting themselves on the back for making the right choice, and then get into a heated argument over which text editor is the best.


                                        Bringing back the golden days of Bell Labs

                                        A New York Times article (business model: “Uber for articles about the good old days”) about an attempt to recreate Bell Labs (business model: “Uber for the telephone”) in Silicon Valley. Hackernews, most of whom are too young to remember the good old days, bemoan the fact that everything was better back then and that the world is going to shit. A few Hackernews try to explain to the others that the world has always been going to shit, and that things were never as good as they seem in retrospect.


                                        Alex Jones must pay $4m in damages for Sandy Hook hoax claims

                                        Alex Jones (business model: “Uber for bullshit”) has been ordered to pay $4 million in damages for claiming that the Sandy Hook massacre was a hoax. Hackernews, who have never heard of Alex Jones or Sandy Hook, spend the next few hours trying to figure out what a hoax is.


                                        Is DALL-E 2 ‘gluing things together’ without understanding their relationships?

                                        OpenAI (business model: “Uber for AI”) releases a new version of its DALL-E image-generation algorithm, which is able to generate images from textual descriptions. Hackernews, who are not sure what an algorithm is, spends the next few hours trying to figure out what an image is.

                                        1. 21

                                          A New York Times article (business model: “Uber for articles about the good old days”)

                                          Hackernews, most of whom are too young to remember the good old days, bemoan the fact that everything was better back then and that the world is going to shit.

                                          Alex Jones (business model: “Uber for bullshit”)

                                          Okay, I think it’s safe to say that GPT-3 just passed the Turing test with flying colours :-D

                                          1. 10

                                            This is pretty much perfect!

                                            1. 6

                                              This would be the only weekly newsletter I would subscribe to, awesome.

                                              1. 1

                                                These are so good that I’m almost tempted to ask for evidence that you actually ran these through GPT-3 instead of writing them yourself.

                                                I wonder how far are we from a Netflix comedy special that’s entirely performed live by an AI…

                                                1. 2

                                                  I wonder how far are we from a Netflix comedy special that’s entirely performed live by an AI…

                                                  We’re already there!

                                                  Seriously though, these systems seem pretty nifty for brainstorming, but the extreme cost of re-training makes it difficult to generate something topical. Even OpenAI’s newest, biggest, most expensive text model (text-davinci-002) is running a year behind on training data.

                                              2. 2

                                                I tried replacing the GPT-3 prompt with:

                                                "Write a snarky one-sentence summary of the following article: %s\n\n"
                                                

                                                Here is the result. Not particularly snarky. Maybe GPT-3 needs to be shown an example of the tone in order to maintain it.

                                                1. 10

                                                  Tried “Write a dark-humorous one-sentence summary of the following article:\n%s\n\n” on gpt-3 playground (using text-davinci-002) for the first few lines of https://github.com/hackergrrl/art-of-readme, and I got this:

                                                  A dark-humorous one-sentence summary of the article would be: “The README file is a long-standing tradition of developers trying to be helpful, but really just annoying users.”

                                                  1. 2

                                                    Please @nathell provide different toned variants like this!

                                              1. 4

                                                The webUSB emulation part seems interesting, all the other parts regarding who liked whoms album and streaming less so.

                                                1. 3

                                                  And I thought that C++ template metaprogramming was fun, this is even better :)

                                                  1. 4

                                                    This is obviously a screenshot of KDE. I can’t say whether this blog is trolling or just ill-informed.

                                                    1. 6

                                                      It’s tagged here as “satire”. There are some joke articles on the site, though also some more serious articles,

                                                      1. 2

                                                        Thanks. I missed the tag, clearly.

                                                        1. 1

                                                          Satire and Linux, so I hoped the joke was clear enough. Although, windows 11 light theme could pass for kde in a short glance. Lunduke has good stuff, sometimes serious, sometimes historical, but sometimes also phoronix level clickbait.

                                                        2. 1

                                                          The shiny new “Dolphin” file manager was a dead give-away, tag or no :)

                                                        1. 10

                                                          First off, this is hilarious:

                                                          ❗ This post is over ten years old. It may no longer be up to date. Opinions may have changed.

                                                          No, ed is timeless in its unmatched might! :)

                                                          Anyway…

                                                          Back in the bad old days when Linux wasn’t a thing and myriad workstation vendors with frustratingly incompatible UNIx versions held sway, being a system administrator was painful, and just ONE of those pain categories was trying to keep your $TERMINAL variable and your actual terminal in sync, as well as ensuring that the system you’re on had the right terminfo/termcap nubbins.

                                                          In short, Curses based applications were as always awesome but SUPER dicey at times, and when the chips were down and production was in jeopardy, my personal bacon was saved more than once by being able to connect to the server and edit that zorched configuration file with ed :)

                                                          ed /etc/mission_critical.cf
                                                          /BROKEN_THING
                                                          s/BUSTED/WORKING/
                                                          1,$p
                                                          w
                                                          w!
                                                          q
                                                          

                                                          :)

                                                          Yup. Still rattling around in there somewhere :)

                                                          1. 6

                                                            First off, this is hilarious:

                                                            ❗ This post is over ten years old. It may no longer be up to date. Opinions may have changed.
                                                            

                                                            No, ed is timeless in its unmatched might! :)

                                                            That’s an auto-generated piece my self written static site generator adds to every article over one year old, but, for ed I agree it could probably skip it. Not configurable though.

                                                            I saw that at @jlelse’s site and thought it was a nice feature.