Threads for keybits

    1. 6

      I’m not sure why the iTerm Solarized theme is designed this way (there must be a reason!) but I’m pretty sure I prefer the version where the “bright” colours are actually colours instead of all being shades of gray.

      This is actually as originally specified by Ethan Schoonover, the designer of Solarized, who used it as a way of fitting the larger set of “base” tones into the 16 slots afforded by ANSI colors. See the table entitled “The Values” on the website: https://ethanschoonover.com/solarized/#the-values


      I used to use base16-shell + base16-vim, but I didn’t like the actual syntax aspect of the color scheme – in terms of what colors were chosen for different highlight groups. (See https://github.com/tinted-theming/home/issues/10). For the curious, there’s also been a community fork of Chris Kempson’s original base16 work, since he seemed to have gone inactive: https://github.com/tinted-theming

      I finally ended up going off the deep end of color scheme nerdery, formulated my own from scratch, set up neovim and iTerm to use it, and have thankfully resisted the urge to fiddle with it much further. (https://github.com/e-q/okcolors.nvim)

      1. 2

        Thanks for sharing your creation.

        set up neovim and iTerm to use it

        Can you explain / share how you use okcolors.nvim with iTerm please?

        1. 3

          To be more precise, I manually created an iTerm2 color scheme to use the colors as the terminal ANSI colors. I’ve uploaded it here: https://gist.github.com/e-q/24a4d04e88a727bf81407f9c831efff3

          1. 2

            Thank you!

    2. 2

      HTTP is the new FastCGI. Do shared hosts not support running persistent processes? If not, they should. File-based script hosting is dead, it’s not general enough and every app wants full control of when things happen.

      1. 2

        Do shared hosts not support running persistent processes? If not, they should.

        Given how many users are typically given accounts on a single host, this would be extremely wasteful for memory compared to CGI. Shared hosting (at least back in the day) was dramatically cheaper specifically because you could fit a lot more customers on a single machine.

        it’s not general enough

        It’s not general enough to replace a VPS, but it’s general enough for me. Just because it doesn’t solve every problem out there doesn’t mean it’s dead.

        1. 4

          Thanks to systemd socket activation is actually trivial to have a http server that starts on demand and shuts down after some period of inactivity, effectively not wasting any ram “just to sit there”. Sorry for the twitter link, but if someone wants to follow I posted description recently: https://x.com/dpc_pw/status/1797540651229438147

          1. 2

            The ability to do this was recently added to SvelteKit: https://kit.svelte.dev/docs/adapter-node#socket-activation

            This opens the way for hosting many SvelteKit apps on a single host with automatic shutdown and near instant startup.

            The author of the above feature has a project that packages up SvelteKit apps, a Node.js executable and glibc++ (The total size of the final image is approximately 37 MB). This is deployed as a systemd ‘Portable Service’: https://github.com/karimfromjordan/sveltekit-systemd

        2. 1

          Given how many users are typically given accounts on a single host, this would be extremely wasteful for memory compared to CGI

          Two things:

          1. this article is about FastCGI which has similar memory requirements to an embedded HTTP server.
          2. CGI is extremely wasteful for CPU and IO compared to persistent processes.
          1. 3

            Well, but keep in mind that there’s two “modes” of FastCGI:

            • Run a permanent process at a known address.
            • The webserver spawns semi-persistent processes at need, passes them an open socket, uses them as long as they seem busy and interested, then kills them at whim.

            Option 1 is the most well-known, because it makes sense for php-fpm. But IMO option 2 is the more interesting one, because it gets you the performance benefits of a persistent process while preserving a shared host’s ability to keep prices low by over-subscribing a server where many of the hosted sites and apps have very low-traffic.

            Personally, I want option 2 but for HTTP — call it a “reverse-proxy scheduler” model. Use config to mount a small http-speaking app at a particular path in your site’s URL hierarchy, and let the main web server spawn/kill it as it sees fit. This doesn’t exist, but IMO it should; and glancing around, it doesn’t seem like I’m the only one who wants this.

            1. 2

              The webserver spawns semi-persistent processes at need, passes them an open socket, uses them as long as they seem busy and interested, then kills them at whim.

              Isn’t that how Heroku worked? They would run your HTTP-speaking application in a container, which AFAIK would be killed off if idle for a while. Also I think a lot of these modern cloud offerings like AWS and Azure have something that works in a similar way. I think the main problem with these things is that it’s a bit heavier-weight and more expensive. Sounds very much like your “reverse-proxy scheduler”

            2. 1

              Yeah, as I said before here I have thought FastCGI should have been HTTP for over 25 years.

            3. 1

              Have you looked at Wagi? https://github.com/deislabs/wagi

              wasm aims to be the spiritual successor to some of the cgi functionalities mentioned in this thread.

      2. 2

        Yeah so I was going to “invent” AGI (Andy’s Gateway Interface) – which is just any HTTP server with FastCGI-style process management …

        AGI_LISTEN_PORT=9090  # server sets this, and the binary listens on that port 
        (could also be Unix domain socket path)
        AGI_CONCURRENCY=2  # for threads or goroutines perhaps
        

        The key points are

        • PHP-like deployment. I drop a file in and it runs …
        • Your process can be killed, made dormant, and restarted at any time. This is necessary for shared hosting to be economical. 99% of apps have like 100 hits or less a day. You don’t want to take up server memory keeping them alive. This is precisely the “cold start” issue in the cloud, which has a rationale

        This does not exist currently, but there’s no reason it shouldn’t!


        Most shared hosts don’t support persistent processes. Dreamhost doesn’t.

        Mythic Beasts does, but somewhat surprisingly it exposes systemd config files in your home dir:

        https://www.mythic-beasts.com/support/hosting/python (I haven’t set this up yet, but I will)

        OpalStack has some pretty weird advice for Go servers: https://community.opalstack.com/d/695-golang-in-opalstack

        Like basically using cron jobs to restart them … this seems like “non-support”.


        My guess that it creates more of a server management headache. But it is something that the cloud providers have solved, and it gives a better user experience.

        1. 3

          Mythic Beasts does, but somewhat surprisingly it exposes systemd config files in your home dir:

          Systemd actually provides most of a solution here. Use socket activation to start your daemon when a connection comes in and then your daemon can exit itself after some idle time. If another tcp connection comes in, Systemd will reuse the connection to the daemon while it still exists and start the daemon again if it has exited.

          1. 1

            Yeah I’m definitely going to kick the tires on this … Last week, I set up uswgi on OpalStack, and I also wanted to try the recommended Python thing on Mythic Beasts

        2. 1

          Don’t forget about scgi too.

    3. 15

      Here’s my currently unsolved problem:

      1. I don’t like using build tools. I like linking to some JavaScript in my HTML and having everything work, without needing to maintain some kind of webpack/vite/whatever-is-hot-right-now build mechanism.
      2. I really like ES modules - with HTTP/2 in particular I love the idea of just being able to import {html, render} from '/static/lit-html.js' and have any other dependencies get loaded for my automatically.
      3. I also like dynamic loading - I’d like my code to be able to avoid loading heavy dependencies until a user interaction needs them - function parsePdf(file) { const pdfjsLib = await import('/static/pdf.js'); //... kind of thing.
      4. So… what I want is for library providers to give me a nice clean distribution of their ES module code that I can host on my own server and link to directly.

      The challenge is that many libraries don’t offer such a distribution! Their installation instructions are npm install X and the rest is left up to me.

      … and I have not yet found a reliable incantation to turn a npm install x instruction into a standalone set of ES module files that I can host on my own server, unbundled and ready to be dynamically loaded into my own scripts.

      Why does this relate to CDNs? Because there are CDNs out there that mostly solve this problem for me - for example jsdelivr: https://www.jsdelivr.com/package/npm/pdfjs-dist gives me import pdfjsDist from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm' - which is how I want to use that library.

      The challenge is turning that into an asset I can load entirely independently of that CDN. Sometimes this works, but for a lot of packages I find that the jsdelivr ESM version then imports more packages, so I need to figure out how to download ALL of those dependencies and then rewrite their code to point to locally hosted versions.

      I tried writing my own tool for this last year but it’s not very good and I don’t want it to exist: https://github.com/simonw/download-esm (UPDATE: just saw libman in this thread which looks like a much more mature attempt at the same problem)

      So… the temptation to drop in a link to a CDN-hosted version of an ES module remains strong for me.

      I wish JavaScript libraries would do what jQuery has always done: Give me a link like https://code.jquery.com/jquery-3.7.1.min.js to a file that I can download and use in my project, no npm incantations required.

      (There’s a lot more to this problem, and I think it’s probably solvable - but I haven’t developed enough modern JavaScript literacy to solve it).

      1. 4

        I use Nix to fetch/hash & linkFarm from CDNs so I can have access to the scripts built & shipped to these CDNs, but can then host them first-party.

        1. 1

          Is this written up somewhere? Specifically, getting a single file from the CDN is easy enough with nix, but how do you also automatically grab dependencies like fonts, css, and images?

          1. 1

            I just reference them manually since it is less than 20 files from unpkg.

      2. 3

        What I ended up doing was to download my deps from a CDN at build time and then serve them as static files.

      3. 3

        Rails has been pushing ‘no build-step on the frontend’. Their solutions is: https://github.com/rails/importmap-rails

        Specifically it seems to solve the ‘donwload dependencies’ problem:

        Importmap for Rails downloads and vendors your npm package dependencies via JavaScript CDNs that provide pre-compiled distribution versions.

        You can use the ./bin/importmap command that’s added as part of the install to pin, unpin, or update npm packages in your import map. This command uses an API from JSPM.org to resolve your package dependencies efficiently, and then add the pins to your config/importmap.rb file. It can resolve these dependencies from JSPM itself, but also from other CDNs, like unpkg.com and jsdelivr.com.

        https://github.com/rails/importmap-rails?tab=readme-ov-file#using-npm-packages-via-javascript-cdns

        Perhaps importmap-rails could be useful for creating a more general approach like you’re working on with download-esm?

        1. 3

          Oh that’s fantastic, thanks! Import maps are the missing piece of the puzzle for me - I know they exist but I’ve not yet figured out how to use them.

          That Rails tool uses new-to-me https://jspm.org/ which appears to be the thing I most need:

          JSPM provides package management for import maps, allowing any package from npm to be loaded directly in the browser fully optimized without further tooling.

          1. 2

            … and now I’m deeply engrossed in the Guy Bedford cinematic universe which is crammed with fascinating pieces of this problem https://guybedford.com/es-module-shims-production-import-maps

    4. 2

      The book Broad Band is a great read that also celebrates women’s contributions to computing https://www.goodreads.com/book/show/35953464-broad-band

    5. 31

      Is this an argument? Mobile editing is dog shit. It’s just awful top to bottom. I can’t believe we’re 15 years into iOS, and they still don’t have frigging arrow keys let alone actually useable text editing. Almost daily, I try to edit a URL in the mobile Safari and I mutter that every UX engineer at Apple should be fired.

      1. 17

        You know the UX engineers on the Safari team would just love to not have to expose the URL at all…

        1. 12

          I don’t really know why you’re singling out Safari, when Google/Chrome have a long history of actually trying to get rid of displaying URLs. And it’s been driven not by “UX engineers”, but primarily by their security team.

          For example:

          https://www.wired.com/story/google-chrome-kill-url-first-steps/

          (and to be perfectly honest, they’re right that URLs are an awful and confusing abstraction which cause tons of issues, including security problems, and that it would be nice to replace them… the problem is that none of the potential replacements are good enough to fill in)

          1. 4

            Both Apple and Google suck. What’s your point?

            1. 1

              My point is that I’m not aware of Apple, or “UX engineers on the Safari team”, being the driving force behind trying to eliminate URLs, and that we should strive for accuracy when making claims about such things.

              Do you disagree?

              1. 2

                No one claimed that Safari is the driving force for anything. A commenter just brought it up as a source of personal annoyance for them.

        2. 6

          Shrug! Android Play Store, the app, does this. Terrifying! It breaks the chain of trust: Reputable app makers link to an url (thankfully, it’s still a website), but you have to use the app anyway to install anything, which has nowhere to paste the url, let alone see it, so you can’t see if you are installing the legit thing or not. Other than trust their search ranking, the best you can do is compare the content by eye with the website (which doesn’t actually look the same).

          1. 4

            I’m reluctant to install third-party apps in general, but, when I do, preserving a chain of trust seems possible for me: if I click a link to, say, https://play.google.com/store/apps/details?id=com.urbandroid.sleep on Android, it opens in the Play Store app; and, if I open such a URL in a Web browser (and I’m signed in to Google), there’s a button to have my Android device install the app. Does either of those work for you?

            1. 2

              Wow! That did not work in Firefox just one month ago (when I had to install Ruter on my new phone). Now it does. I tried Vivaldi too, and it doesn’t even ask whether I want to open it in Google Play.

              Browser devs to the rescue, I guess, but as long as the app isn’t doing their part – linking to the website – the trust only goes one way.

      2. 14

        The upside: it reduces the amount of time you want to use your phone, which, for most people, is a good thing.

        1. 5

          Does it though? I mean, you’ll spend much longer fiddling to get the text right!

          If you think “oh this’ll just be a quick reply” and then end up actually typing more than you thought you would, it makes sense to finish the job you started on mobile, which then actually takes more time. Especially when you’re on the go and you have no laptop with you.

          1. 1

            It really just means I use the phone for composing conceptually light things because I don’t want to mess with it any more than necessary. (This is likely an adaptation to the current state versus a defense of how it is.)

      3. 7

        I don’t miss arrow keys with iOS Trackpad Mode[1]. The regular text selection method is crap, but it works well enough doing it via Trackpad Mode.

        I think part of the problem with the iOS Safari URL bar is that Apple tries to be “smart” and modifies the autocorrect behavior while editing the URL, which in my case, ends up backfiring a whole lot. There’s no option to shut it off, though.

        1. https://www.igeeksblog.com/how-to-use-iphone-keyboard-as-trackpad/
        1. 4

          Wow, I had no idea this existed! Apple’s iOS discoverability is atrocious.

          1. 2

            Apple’s iOS discoverability is atrocious

            Agreed. Just the other day I found the on screen keyboard on my iPad was floating and I couldn’t figure out how to make it full size again without closing the app. A few days later I had the thought to try to “zoom” out on the keyboard with two fingers and it snapped back into place!

            As someone more comfortable with a keyboard and mouse, I often look for a button or menu. When I step back and think about how something might be designed touch first, the iOS UX often makes sense. I just wish I had fewer “how did I not know that before!” moments.

          2. 1

            I mean, what meaningful way is there to make it discoverable? You can’t really make a button for everything on a phone.

            One other commonly unknown “trick” on ios is that clicking the top bar often works as a HOME key on desktops, but again, I fail to see an easy way to “market” it, besides clippy, or some other annoying tutorial.

            Actually, the ‘Tips’ app could actually have these listed instead of the regular useless content. But I do think that we really should make a distinction between expert usage and novices and both should be able to use the phone.

            1. 1

              I really don’t have an answer to that. I’ve never looked through the Tips app, not have I been very active in reading iOS-related news[1]. Usually I just go along until I find a pain point that’s too much and then I try to search for a solution or, more often, suffer through it.


              [1] I do enjoy the ATP podcast, but the episodes around major Apple events are insufferable as each host casually drops $2,000 or more on brand new hardware, kind of belying their everyman image.

        2. 2

          This seems super useful, but I’ve spent the last ten minutes trying to get it to

          1. Enter selection mode using 3D touch
          2. Get the trackpad to not start jittering upward or downwards

          It seems either that my phone’s touchscreen is old and inaccurate or I am just really dang bad at using these “newfangled” features.

          I agree with your other reply - discoverability is atrocious. I learned that you can double/triple tap the back of your phone to engage an option which blew my mind. I wonder what I’m missing out on by not ever using 3D touch…

        3. 1

          The other problem I encounter near daily is not being about to edit the title of a Lobsters post on the phone. It really sucks.

          1. 1

            The far more frustrating thing on lobste.rs is that the Apple on-screen keyboard has no back-tick button. On a ‘pro’ device (iPad Pro), they have an emoji button but not the thing I need for editing Markdown. I end up having to copy and paste it from the ‘Markdown formatting available’ link. I wish lobste.rs would detect iOS clients and add a button to insert a backtick into the comment field next to the {post,preview,cancel} set.

            1. 7

              Long-press on the single-quote key and you should get a popup with grave, acute etc accents. I use the grave accent (the one on the far left) for the backtick character.

              Edit testing if this actually works. It does!

              1. 2

                Thank you! As someone else pointed out in this thread, iOS is not great for discovery. I tried searching the web for this and all of the advice I found involved copying and pasting.

                1. 3

                  This is a general mechanism used to (among other things) input non english letters: https://support.apple.com/guide/ipad/enter-characters-with-diacritical-marks-ipadb05adc28/ipados

                  1. 2

                    Oddly enough, I knew about it for entering non-English letters and have used it to enter accents. It never occurred to me that backtick would be hidden under single quote.

            2. 1

              You can make a backtick by holding down on single quote until backtick pops up, but it’s pretty slow going.

      4. 5

        Samesies. The funniest bit, at least for me, is that I’m usually just trying to remove levels of the path, or just get back to the raw domain (usually because autocomplete is bizarre sometimes). This would be SUCH an easy affordance to provide since URLs already have structure built-in!

      5. 5

        You may already know about this, but if you put the cursor in a text field, and then hold down on the space bar, after a second or two you enter a mode that lets you move the cursor around pretty quickly and accurately.

        edit: I guess this is the “trackpad mode” mentioned below by /u/codejake

      6. 4

        I find the trick of pressing down on spacebar to move the cursor works pretty well.

        1. 1

          It’s okay but it’s still not as good as digital input for precision.

      7. 1

        The problem is that Apple phones don’t have buttons.

        1. 1

          No phones do anymore, it seems…

          1. 2

            Arthur C Clarke predicted this in The City And The Stars. In its insanely-far-future society there is a dictum that “no machine shall have any moving parts.”

            1. 2

              I wish people would be a little pickier about which predictions they implement and maybe skip the ones made in stories with a dystopian setting. Couldn’t we have sticked to nice predictions, like geostationary satellites?

      8. 1

        It’s hidden, but… tap url bar, then hold down space and move cursor to where you want to edit. Now normal actions work ( e.g. double tap to select a word).

        That said I agree with your second sentence.

        1. 2

          The trackpad mode works very poorly on the iPhone SE because you can’t move down since there’s no buffer under the space key, unlike the newer phone types. It doesn’t work well for URLs because the text goes off screen to the right, and it moves very slowly. Ironically I’m on an iPad and I just tried to insert “well” into the last sentence and the trackpad mode put the cursor into the wrong place just as I released my tap. It just sucks. This is not a viable text editing method.