Author: Simon

  • Learning chords with ChatGPT voice conversations

    Asked ChatGPT voice* to quiz me on chords while I was walking around the neighbourhood.

    Voice recognition was good, response time was good. I didn’t love the “connecting…” stage to kick of the chat. And had bit of a buggy launch, but once started it was solid.

    Initially it would ask a single question, I would answer, then it would say “do you want to continue?”. I asked it to skip that and just keep going until I left, which it did remember to do.

    It kept pronouncing Bb as “beebee”, and Eb as “Ebb”, and wouldn’t remember to correct. I could maybe have solved this with initial prompt – either “you are a music teacher” or “always pronounce sharp and flat correctly”.

    Overall this launching from “please quiz me on chords for different keys”** was very impressive.

    This part later when I put my phone on the table and left the room was a little unsettling. Apparently the sound of my door closing said “This is Deokyoung Lee from MBC News” in Korean.

     

     

    *Enabled in beta features of app.

    **actual initial prompt: “Can you quiz me on notes in piano chords in different keys? Either the key name and I’ll name the notes.”

     

  • get intents for google recorder

    trying to find a way to automate google recorder using Tasker. Prompt suggested using Intents.

    helpful stackoverflow gave abd command to run.

    windows computer has recentish adb installed, doesn’t have grep, so this part fails.

    | fgrep -i intent

    remove that and list everything to a file, we can find relevant bits later.

    Ended up finding something for stopping recording, but not for starting
    10-07 21:07:59.900 31231 31231 I Recorder_RecordViewMode: Recording is ending
    10-07 21:07:59.901 31231 31231 I Recorder_RecordingEngin: Scheduling stopRecording

  • Will LLMs worsen link rot?

    Link rot is bad enough already, probably going to get worse if “sources” are added automatically.

    Example Conversation

    “Comparing Animal Strengths in Relation to Humans” linked to “Influence of the Hohenwarte reservoir on tilt and strain observations at Moxa”
    “Human vs. Animal Physical Capabilities” was a 404 on oxford academic.

    Since it’s prone to hallucinating external information, there seems to be a tendency to either get links wrong, or make them up entirely. In some non-web-enabled ones it would claim to read a link provided, and tries to guess the content based on link text.

  • Generate app implementation details with ChatGPT

    Conversation

    My first question was far too general, so got me some generic unhelpful answers.

    Asking for 20 ideas (inspired by Brainstorming section from this talk) and  including specifics got better specific answers.

    Conversation helps refine requirements. In this case I wanted to think of some different possible interfaces, and maybe technology suggestions for a specific part of it.

     

  • Mixxx MIDI Mapping with ChatGPT Code Interpreter

    Conversation

    Some success, still in progress.

    Lazy attempt to get a 2 deck controller to control 4 decks in Mixxx, like this example.

    Fun part about halfway through where it just started hammering through errors trying to debug itself. I think the uploaded file had expired by then (I had also switched computers). But “Show work” for the troubleshooting steps is still interesting to look through – things like not importing things before using them.

    In earlier attempt it didn’t know the actual MIDI values of the controller, so I started by uploading someone’s mapping and asking some things about that – it also had some features like pitch fader scaling that I wanted to understand. The initial extraction and explanation was pretty good, but then it got a bit lost when trying to make changes and actually implement things.

    But by the end it got a reasonably complete looking mapping JS file. But some issues with the actual mapping, and follow-up questions for fixing syntax errors were not so good, and it got a bit confused when I uploaded the updated files (it still referred to things from earlier versions of them). Maybe a good reason to start new chats for troubleshooting, though keeping the context of the previous chat would be useful.

    Might try “generate a summary of this chat to start a new one with context and the current versions of the files”.

     

  • The right way to disable CSS animations

    Sometimes I want a way to disable all CSS animations on a page. This is useful for end-to-end testing, automatic screenshots, or reducing motion sickness risk. This recent CSS Tricks post suggests disabling animations & transitions while resizing, to reduce needless browser work. This is an excellent idea! Here is the usual way of disabling animations:

    (more…)

  • CSS snippet for better mobile screenshots

    A useful tip when adding screenshots to posts or talks is to put them “inside” a device. This gives the screenshot some context.

    Even though this screenshot already contains Android top & bottom bars, with the added outline it’s immediately obvious it’s from a phone.

    The Economist on mobile is mostly sticky bullshit

    The Economist on mobile is mostly sticky bullshit

    To add the outline to images I use a simple CSS border:

    .phone-border {
      border: #111 solid;
      border-radius: 1rem;
      border-width: 2rem 1rem 3rem 1rem;
    }
    
    

    To take this further you can also make them responsive! So we see phone screenshots on phones, and a fake laptop screen outline on big/wide screens. This assumes you are using responsive images so you get desktop aspect ratio on bigger screens.

    @media (min-width: 800px and min-aspect-ratio: 16/9) {
      .phone-border {
        border-color: #ccc;
        border-width: 1rem;
      }
    }
    
    

     

  • A little Awk

    Awk is a command for doing things with text files. We give it a text file and it can do an action on each line. So we can print the whole line, or part of the line, or reorder parts.

    As a simple example, here’s a CSV of people’s last name, first name, age, and nationality:
    Branch, Polly, 28, Romanian
    Moore, Luis, 25, Uruguayan
    Conley, Julia, 37, Luxembourger

    We want to run Awk and have it print their First and Last names, i.e
    Polly Branch
    Luis Moore
    Julia Conley

    Let’s do it. Firstly, download humans.csv to your Downloads folder. Then open a terminal and go to Downloads:

    cd ~/Downloads
    ls humans.csv

    This should print ‘humans.csv’ if the file exists.

    To use Awk, you type awk, then tell it when you want it to do inside single quotes, then give it a file. The simplest example is telling it to print the whole file, like this:

    awk '{print $0}' humans.csv

    Your Awk ‘program’ here is the part inside quotes. Awk programs usually start with { and end with }. We need the quotes because command line needs to know to include the spaces. Whatever is inside the curly braces will be run for each line in the file.

    So print means ‘print’, and $0 means ‘the entire line’. But we just want to print part of the line. Awk splits the line into pieces, we can access the pieces with $1, $2, etc. So if we just want to print the first word on each line:

    awk '{print $1}' humans.csv

    This prints:
    Branch,
    Moore,
    Conley,

    They have commas after them because by default Awk splits using spaces. We can tell it we’re using commas by passing a -F argument, like this:
    awk -F, '{print $1}' humans.csv

    And now we just print the last names!

    Next we want to print the first name and the last name. If we run this:
    awk -F, '{print $2 $1}' humans.csv

    then something a bit weird happens.
    PollyBranch
    LuisMoore
    JuliaConley

    print ignores the spaces we put between $2 and $1. To make it put a space we can either use a comma, or put a space in quotes.

    Using comma:
    awk -F, '{print $2,$1}' humans.csv

    or putting a space in quotes:
    awk -F, '{print $2 " " $1}' humans.csv

    This example says to Awk: “print the first name, then a space, then the last name”.

    Polly Branch
    Luis Moore
    Julia Conley

    Done!

    …Almost. There is still an extra space at the start of the line. This is because the example CSV had commas and spaces, and we are telling Awk to split on commas. So when it splits a line, it splits it into: “Branch”, ” Polly”, ” 28″, and ” Romanian”.

    So for this particular CSV we actually want to split using “comma followed by space”.

    We can use -F', ' again:
    awk -F', ' '{print $2 " " $1}' humans.csv

    Next we’ll look at some more complex actions, and how to match only certain lines.

    References

    Inspired by https://gregable.com/2010/09/why-you-should-know-just-little-awk.html
    GNU Getting Started with Awk

  • Intercept requests with puppeteer

    useful to mock backend responses when you don’t want to have to donate RAM to minikube when developing locally

    // from https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetrequestinterceptionvalue
    
    const puppeteer = require('puppeteer');
    
    (async function main() {
      try {
        const browser = await puppeteer.launch({ headless: false });
        const [page] = await browser.pages();
    
        await page.setRequestInterception(true);
        page.on('request', (interceptedRequest) => {
          if (interceptedRequest.url().includes('additional_metrics.json') {
            interceptedRequest.respond({
              metrics: {},
            });
          } else {
            interceptedRequest.continue();
          }
        });
    
        await page.goto('http://localhost:3001/users/sign_in');
        await page.type('input[name="user[login]"]', 'root');
        await page.type('input[name="user[password]"]', '5iveL!fe');
        await page.click('.qa-sign-in-button');
    
        await page.waitForSelector('.header-user-dropdown-toggle');
    
        // await browser.close();
      } catch (err) {
        console.error(err);
      })
    });
  • Numeronyms make Awful Names

    a16z – Andresson Horowitz. I don’t hear/use this often enough to remember it, so completely forget what it stands for

    a11y – Accessibility. I come across this all the time, yet can never remember what word it is short for. Yet I link ‘a11y’ to the concept of accessibility. My issue with this is possibly due to pronunciation. Is it ‘ay-eleven-why’? Is it ‘Alley’? A-1-1-y? All terrible. I suspect this one is common because a11y is easy to type, and accessibility is easy to misspell.

    i18n – internationalization. I remember the concept and the acronym. Often forget what it expands to. Doesn’t help that GitLab docs link is /externalization (e13n).

    k8s – Kubernetes. Even after months of using this, the acronym always takes me time