• 5 Posts
  • 178 Comments
Joined 2 years ago
cake
Cake day: June 14th, 2023

help-circle
  • Some of those details are portable, particularly the behavior of code objects. Function declarations (def statements) bind code objects to names within a namespace; binding within a class namespace will create methods by calling the declared metaclass, which defaults to the type() builtin type object.

    Some other details are not portable. CPython stores code objects on the C heap and allocates generic closures; it supports either a dict from strings to locals, or user-declared slots naming a tuple of locals. PyPy automatically computes slots in all cases and supports the dict as a special case. Threads generally share a single heap per interpreter, so the creation of threads doesn’t matter for declaring or instantiating objects; note that the community makes this work by pushing the convention that .__init__() methods should not do computation and instead should merely initialize the locals, akin to similar conventions in C++. That said, Jython threads are Java threads, not OS threads like in CPython or PyPy, so normal assumptions about threading may not hold.

    You will have to let go of some of your practices around memory management. Python is memory-safe and garbage-collected by default; while sometimes you’ll want to remove names or map keys with del, it usually isn’t necessary. Similarly, while there are maybe a half-dozen ways to customize class creation and memory layout, it’s almost never actually necessary to use more than one of them at a time. Instead, stick to writing Pythonic code, and let runtimes like PyPy worry about performance. PyPy goes fast by simplifying what happens under the hood; if it exposed guaranteed internal structure then it would be slower.


  • In terms of the standard principal programming paradigms, Python is on the right-hand side in the “Shared state” column. Note two interesting things: first, Python’s box is represented by Java and OCaml; second, the box has two labels, “Sequential object-oriented programming” and “Stateful functional programming”. Python is technically a prototype-based language like ECMAScript, but it can be seen as either object-oriented or functional depending on whether we think of prototypes as classes or closures respectively.

    Note that unlike “Imperative programming”, represented by Pascal and C, Python has closures. It does have closure quirk, also called lambda quirk, which ruins an otherwise-lexically-scoped language, but folks with lots of Python experience are used to working around closure quirk. Python functions are not procedures; they are sugar for objects with a .__call__() method.

    If this is your first time with the principal paradigms, please keep in mind the following quotes. First, from the associated book:

    More is not better or worse than less, just different.

    That is, Turing-completeness doesn’t have a canonical set of computational features. Second, from the chart PDF:

    Two languages that implement the same paradigm can nevertheless have very different “flavors” for the programmer, because they make different choices on what programming techniques and styles to facilitate.


  • This is for short-lived cloud-allocated (virtual) machines which have an IPv4 address but not necessarily a DNS presence. When there are more than a handful of machines, name management becomes its own unique pain; often, the domain names of such a machine are an opaque string of numbers under some subdomain, and managing the name is not different from managing the raw IP address instead. Similarly, for the case of many machines all serving a wildcard (e.g. a parking page) allocating a single IP-address certificate might be preferable to copying the wildcard certificate to each machine.

    As you point out, though, SSH exists and has accumulated several decades of key-management theory. Using HTTPS instead of SSH for two machines with one owner is definitely not what I would do. I’ve worked at all scales from homelabs to Google and I can’t imagine using IP-address certificates for any of it.

    Now, with all of that said, if Let’s Encrypt were available over e.g. Yggdrasil then there would be a use-case for giving certificates directly to IPv6 addresses and extending PKI to the entire Yggdrasil VPN. That seems like a stretch though.


  • Nix comes closest. The biggest issue with Nix is that it does not admit a clean simple LL/LR grammar, but I think it admits a PEG, which is fine for practical work. The ecosystem could use more independent implementations and tooling, but I haven’t found any deficiencies with the language that would make me prefer e.g. Guile Scheme’s larger standard library and richer types.

    HCL is another option. It’s not awful, but it’s verbose when trying to do anything higher-order, and it wasn’t intended to directly represent lambda-style subroutines. Guile Scheme, as used in Guix, is clearly capable, but requires embedding a fairly large standard library or having to NIH common routines; similar problems plague Lua or Python.

    I think that your question has an interesting framing. My first answer was to mention jq and the relational pipes toolkit, but those are still run from a top-level shell. For example, I suppose that there’s two things that you can do with JSON: you can manipulate it and I would use jq for that, or you can load it as a datastructure into a (build) action and I would use Nix for that. jq is close to ideal for its particular formalization, but relational pipes are still evolving and I think that there are further simplifications that could be made.





  • Put a rescue distro on a USB stick. When you first boot the laptop, use the rescue distro. Write down the USB IDs (lsusb) and PCI IDs (lspci). Read through the kernel boot log (sudo dmesg | less) and write down the names of any kernel drivers that might matter; WiFi, GPUs, USB bridges, and keyboard layouts are important in particular. For laptops, look up manufacturer-specific drivers for keyboards, fans, and power management.

    Linux requires about 8MiB of RAM to boot. The entire netbook movement relied on machines with 2GiB or less; I remember putting Linux onto a 2GiB Sony VAIO that had struggled to boot Windows. Your laptops aren’t too small, but you may be choosing distros with poor hardware support or large monolithic packages. I bet that one of Debian, Gentoo, or NixOS would boot on those machines that still work; of those, Debian is probably easiest.

    Old laptops sucks. Windows use to be very efficient. XP and 7 has held up very well after all these years. And most importantly Linux isn’t a one size fits all solution.

    Nah, Windows sucked back then too. If a machine boots Windows XP or Windows 7, then it can easily be made to boot an out-of-the-box Linux distro. The Asus machine you listed might have some boot issues, but the Acer and Dell do not appear different from any of the Acers or Dells that I’ve put Linux on in the past decade. My daily driver is a $150 refurbished Dell Latitude 5390 running NixOS.





  • I would rather use Magic Wormhole if I have to have an intermediate server operated by somebody else.

    Your protocol isn’t documented enough to allow interoperability. It is important for folks to be able to develop their own clients and frontends; the ecosystem becomes richer and more resilient to attacks when there are many different implementations.

    I’m not sensing an awareness of capabilities. Access to a file is one of the classic examples of a capability and a file-sharing system should be oriented around ensuring that references to files are unforgeable and copyable.

    The terms of service are unacceptable and I won’t be trying out the product. I can point at exactly what’s wrong; talk to your attorney for details.

    Users are expected to respect the intellectual property rights of others when using the app.

    You don’t understand what file-sharing technology is used for.

    We reserve the right to introduce tools and technologies for monitoring the performance of the app and improving its functionality. By using the app, you acknowledge and agree to this potential monitoring.

    Ah yes, because telemetry has never been met with user backlash.

    The company does not collect user data, apart from what is needed for monitoring tools to ensure the app’s stability and to make improvements.

    You don’t need user data for that. Y’know what’s a lot easier? Just don’t collect user data!

    We may also use Sentry.io for error monitoring and NLevel Software for analytics.

    I block those.

    The app may include functionality to report users, and we reserve the right for this functionality to send necessary details for any investigation.

    Ah yes, completely fair that somebody accused of misbehavior gets their local data exfiltrated too.

    Meanwhile Magic Wormhole merely tells us that it is MIT licensed and we can do whatever we like with it.


  • And here we see the self-Godwin in the wild. Masterful play, sir.

    Neither the CFO nor CEO are saying that Google ought to be not broken up. They are saying that Mozilla existentially depends on Google. This is actually more of a central point in the lawsuit than you think; in the original complaint, part 6 of the background is about revenue-sharing agreements (RSAs) between Google and various other companies who would normally compete in search, browsers, and other venues. That is, nobody is disputing that:

    Today, Google has RSAs with nearly every significant non-Google browser (other than those distributed by Microsoft) including Mozilla’s Firefox, Opera, and UCWeb. These agreements generally require the browsers to make Google the preset default general search engine for each search access point on both their Web and mobile versions.

    If Mozilla did want to petition the court, then they are welcome to file as amici, but they haven’t! Nor have any court filings included a reference to the CFO’s testimony so far, although to be fair the testimony isn’t yet available to read. There is no evidence that Mozilla will stand in the way of whatever the court decides to do with Google. Rather, in their post, the CEO is asking lawmakers to figure out some way to ensure that the browser market remains competitive:

    Mozilla calls on regulators and policymakers to recognize the vital role of independent browsers and take action to nurture competition, innovation, and protect the public interest in the evolving digital landscape.

    Courts aren’t regulators or policymakers. The complaint before the court is not the same as the underlying principles of antitrust which motivated the complaint. A request to improve the future is not the same as a request to forestall the present.


  • The author would do well to look up SGML; Markdown is fundamentally about sugaring the syntax for tag-oriented markup and is defined as a superset of HTML, so mistaking it for something like TeX or Word really demonstrates a failure to engage with Markdown per se. I suppose that the author can be forgiven somewhat, considering that they are talking to writers, but it’s yet another example of how writers really only do research up to the point where they can emit a plausible article and get paid.

    It’s worth noting that Microsoft bought PowerPoint, GitHub, LinkedIn, and many other things—but it did in fact create Word and Excel. Microsoft is, in essence, a sales company. It’s not too great at designing software.

    So close to a real insight! The correct lesson is that Microsoft, like Blizzard, is skilled at imitating what’s popular in the market; like magpies, they don’t need to have a culture of software design as long as they have a culture of software sales. In particular, Microsoft didn’t create Word or Excel, but ripped off WordPerfect and Lotus 1-2-3.




  • Pick a language like Perl, where some packages are written in C and some are written in pure Perl, and you’ll get to experience the same cryptic GCC errors, sometimes. There’s no secret to pip; many Python developers upload wheels with pre-compiled binaries, including Windows-compatible binaries, and so you don’t have to run GCC because they already did it for you.



  • Good notes. Another trick is to replace /etc/hosts (which is usually a symlink to /etc/static/hosts) with a custom file; for example, copy all of the hosts from /etc/static/hosts and then add new hostnames for the failing caches. This can turn an indefinite network timeout into a fairly quick connection-failed error.

    Personally I think it’s a design deficit in Nix that is compounded by the serial, one-at-a-time, timeout-based way of operating. A Nix implementation should have a sense of trading off disk, bandwidth, compute, and time; a substitution should only be preferred when it is likely to save at least one of those resources, and abandoned if it isn’t making progress.