Skip to content

Instantly share code, notes, and snippets.

View jpillora's full-sized avatar
👶

Jaime Pillora jpillora

👶
View GitHub Profile
@jpillora
jpillora / install.sh
Last active January 24, 2024 13:56
Install Microsoft's VS code-server
#!/bin/bash
set -euf -o pipefail
if [ ! -f code-server ]; then
ARCH=$(uname -m)
OS="unknown-linux-gnu"
echo "downloading code-server ($ARCH-$OS)"
URL="https://vscodeserverlauncher.blob.core.windows.net/builds/latestbin/$ARCH-$OS/$ARCH-$OS"
curl -L "$URL" >code-server
chmod +x code-server
@jpillora
jpillora / test.js
Last active April 6, 2024 01:27
async javascript test
const MAX_INFLIGHT = 4;
const TOTAL = 100;
// the given dummy api supports a maximum of 4 of inflight requests.
// the given code is correct, but it is slow because it processes elements serially.
// your task is to process 100 elements as fast as possible.
// run this code with "node/bun test.js".
// it should print "pass".
// no external dependencies are allowed.
async function run(elements) {
// ============