Skip to content

Instantly share code, notes, and snippets.

View leafac's full-sized avatar

Leandro Facchinetti leafac

View GitHub Profile

Setting up Ubuntu Cloud virtual machine in macOS with QEMU

Install QEMU:

brew install qemu

Download Ubuntu Cloud:

$ brew uninstall --verbose --debug docker-desktop
/opt/homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::FromAPILoader): loading docker-desktop
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/lame
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/llhttp
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/libtiff
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/gmp
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/libiconv
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/deno
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/ffmpeg
```console
$ brew uninstall --verbose --debug docker-desktop
/opt/homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::FromAPILoader): loading docker-desktop
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/lame
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/llhttp
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/libtiff
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/gmp
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/libiconv
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/deno
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/ffmpeg
import html from "@radically-straightforward/html";
// https://www.youtube.com/watch?v=dSK-MW-zuAc
const order = 2;
const viewBox = 24; /* var(--space--6) */
// Hilbert
// let points = [
// [1 / 4, 1 / 4],
// [1 / 4, 3 / 4],
// [3 / 4, 3 / 4],

We use two tools to measure the performance of slow pages:

  1. 0x: Profile the application and generate flame graphs.
  2. autocannon: Load test (send lots of requests) and measure response time (which autocannon calls “latency”) & throughput.

Here’s a step-by-step guide of how to use these tools in Courselore:

  1. Run the application normally.

    Note: Don’t use a custom HOSTNAME, because autocannon may not recognize the self-signed certificate generated by Caddy.

  • Interpolation
    • What I think of as interpolation many libraries call “dynamic” properties/styles/etc.
    • Astroturf
      • Allows two types of interpolation:
        • Values, using CSS variables.
        • Blocks, using extra classes.
          • Doesn’t seem to support nesting, because that requires you to parse the CSS & extract the classes nested inside.
    • vanilla-extract
      • Doesn’t seem to allow for interpolation.
  • Linaria
  1. Create the tunnel. If you’re part of the Courselore team, you may request a custom Courselore tunnel address such as leafac.courselore.org, otherwise you may use services such as Localtunnel and localhost.run, for example:

    # Custom Courselore Tunnel Address
    $ ssh -NR 3000:localhost:80 root@leafac.courselore.org
    
    # Localtunnel
    $ npx localtunnel --port 80
    

localhost.run