Tuesday, October 1, 2024

Type 'Express' is not assignable to type 'Application'.

We've had a lot of problems with the fact that the DefinitelyTyped packages for Express consists of multiple separate packages (notably @types/express and @types/express-serve-static-core) and that new versions of @types/express don't work unless you update @types/express-serve-static-core too but that the dependencies between them are not declared tightly enough.

https://github.com/apollographql/apollo-server/issues/5280

Use:

npm dedup

Thursday, September 12, 2024

/etc/wsl.conf

 My WSL configuration

[automount]
enabled = true
options = "metadata,umask=22,fmask=11"

Monday, July 1, 2024

Twitter: remove all likes

 The following block will remove all your Twitter likes, if you are on your profile's /likes page:

{
  const sleep = t => new Promise(r => setTimeout(r, t));
  let i = 0;
  while (true) {
    const nodes = document.querySelectorAll('button[data-testid="unlike"]');
    if (nodes.length === 0) {
      console.log('NOOP');
      await sleep(2_000);
      if (++i === 10) {
        console.log('DONE');
        break;
      }
    } else {
      i = 0;
    }  
        
    let j = 0;
    for (const node of nodes) {
      console.log(`${++j} / ${nodes.length}`);
      node.scrollIntoView();
      node.click();
      await sleep(2_000);
    }
  }
}

Wednesday, June 26, 2024

Error 80072EFE during Windows 7 update

Best zstd compression

The highest zstd compression ratio is achieved with zstd -22 --ultra --single-thread
The -22 gives the highest supported compression level.
The --ultra is needed to get above -19.
The --single-thread preempts some issues with the file being corrupted.
(See: https://github.com/facebook/zstd/issues/3350#issuecomment-1352455838

Monday, May 13, 2024

Twitter: collect all links to posts on a page

The following snippet executed in the Developer Console will help you collect all the links to individual posts on a profile. Once the script has been executed, all you'll need to do is to scroll down (or navigate from post to post using the "J" key).

window.links = new Set();

window._updateLinks = () => {
    Array.from(document.querySelectorAll('a > time'))
        .map(node => node.parentNode.href)
        .forEach(link => window.links.add(link));
}

window._handleScroll = () => {
    _updateLinks();
    console.log("Links collected:", window.links.size);
}

window.addEventListener('scroll', _handleScroll);

Once you're ready to collect the data, you can copy it to the clipboard using:

copy(Array.from(window.links).join("\n"));

This will copy the links to all the posts you've scrolled through, one link per line.
Useful e.g. when wanting to archive the content from a profile.