This month I learned - August 2021

Going to try something new. Just listing things that I learn each month. Not on any particular topic, just writing them down as I learn them.

  • GitHub’s automation platform is straight up faster than GitLab’s. Running my CI pipeline takes 45 minutes on GL, and only 10 minutes in GH. Seems like a pretty striking difference considering they are quite literally being paid by the hour.

  • SVGs can contain style tags. https://www.w3.org/TR/SVG/styling.html. Means animations can be added SVGs without having to add styles directly to the document.

  • The WebSocket API doesn’t do chunking, so if you’ve got a lot to load, and want to know progress on the frontend, split your messages. Since they’re sequential, it can be as simple as for each 128 char chunk, send message. See the MDN docs.

  • A solid nginx default can get you a static site hosted pretty quickly. Simple for hosting a Hugo site or something like that. Not super intimidating. Looks like this.

    server {
       listen 80 default_server;
       listen [::]:80 default_server;
       server_name website;
       root /var/www/website/html;
       index index.html;
       try_files $uri $uri/index.html =404;
       error_page 404 /404/index.html;
    }
    
  • nginx automatically does ETag headers for most content, which gives basic caching to start with.

  • Nested styles are coming to CSS. See W3C public working draft.

  • In a Dockerfile COPY ./* /src/ is not the same thing as COPY ./ /src/. First one is not a recursive copy.

  • Building with cargo inside docker doesn’t cache dependencies, so it needs to be done manually. It seems like the most common way to do this is to something like:

    # Copy in your source code
    COPY Cargo.toml Cargo.lock ./
    COPY pkg ./pkg
    
    # Build dependencies only
    RUN rm -rf pkg/app/src/*.rs
    RUN echo 'fn main() {}' >> pkg/app/src/main.rs
    RUN cargo build --release -p app:1.0.0
    
    # Re-copy your source, build your actual target
    COPY pkg ./pkg
    RUN cargo build --release -p app:1.0.0
    

    This splits the build into two parts. So as long as the dependencies don’t change, it’ll skip right to the part that builds the app.

  • You shouldn’t, (but you can! 😀), run Nomad client and server on the same machine because the server can overallocate the client and crash itself, leaving you with two (assuming a triad) remaining nodes, and the possibility of cascading failure. It’s a shame too because it’d be cool just to run a cluster where all of your nodes are the same, but the ones running the server agent have slightly reduced capacity because they’re also servers. “Something there is that doesn’t love a wall between your server and client nodes”.

  • Certbot is so easy to set up for haproxy (https://certbot.eff.org/lets-encrypt/arch-haproxy). I remember doing some cert stuff years ago without it, and it was a pain. Somehow I thought certbot was only a marginal improvement, but it really is a 100x improvement over how dumb and cumbersome the process used to be.

  • Figma allows basic algebra inside numeric fields to set dimension and position of objects. Like 2^8 or 320 * 4.

  • When you turn on the write-ahead-log (WAL) in sqlite, you get access to the frame-data used to construct the updated part of a database for a transaction. If you tailed it, copied it, stored it, and replayed it, you might be able to reconstruct the db at any point in time. Something to try later.

Those are the interesting ones. See you in September maybe.

this-month-i-learned | status-update
2021-08-31