Skip to content

Instantly share code, notes, and snippets.

View jpillora's full-sized avatar
👶

Jaime Pillora jpillora

👶
View GitHub Profile
@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) {
// ============
@sbailliez
sbailliez / vagrant-vmware-tech-preview-apple-m1-pro.md
Last active April 10, 2024 07:51
Vagrant and VMWare Tech Preview 21H1 on Apple M1 Pro

Vagrant and VMWare Tech Preview 21H1 on Apple M1 Pro

UPDATE November 20, 2022: VMWare Fusion 13

VMWare Fusion 13 is now released. Read Vagrant and VMWare Fusion 13 Player on Apple M1 Pro for the latest.

Summary

This document summarizes notes taken while to make the VMWare Tech preview work on Apple M1 Pro, it originated

@sindresorhus
sindresorhus / esm-package.md
Last active April 19, 2024 10:56
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@nolanlawson
nolanlawson / index.html
Created August 25, 2017 17:49
iframe blob uri src
<!doctype html>
<html lang="en">
<body>
<iframe id="theIframe" width="400" height="600" sandbox="true"></iframe>
<script>
var html = '<html><h1>hello world!</h1></html>'
var blob = new Blob([html], {type: 'text/html'})
var url = URL.createObjectURL(blob)
theIframe.src = url
</script>
@posener
posener / go-function-error-reporting.md
Last active February 12, 2024 05:32
Function Failure reporting: Error or OK

Function Failure Reporting: Error or OK

Go's "multiple return values" feature, can be used for several purposes. Among them for failure reporting to the function caller. Go has two conventions for failure reporting, but currently, no clear convention for which to use when. I've encountered different programmers that prefer different choices in different cases. In this article, we will discuss the two, and try to make the process of choosing our next function signature more conscious.

The Basics

@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active April 19, 2024 11:15 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@ekwoodrich
ekwoodrich / DVRIP-Sonia Reference Codes.md
Last active April 4, 2024 02:51
Reference codes for the DVRIP/Sonia TCP protocol used by the Net Surveillance ActiveX plugin

DVRIP/Sonia Protocol

DVRIP/Sonia TCP protocol used by the Net Surveillance ActiveX plugin

1. Response Codes

Return code Definition
100 Success
101 Unknown error
102 Version not supported
103 Illegal request
@tj
tj / main.go
Last active April 10, 2017 06:58
package main
import (
"fmt"
"net/http"
"github.com/apex/go-apex"
"github.com/apex/go-apex/proxy"
)
@abimaelmartell
abimaelmartell / default_gateway.go
Created October 19, 2016 18:52
Get default gateway by parsing RIB information using the net/route package. BSD Only.
package main
import (
"fmt"
"golang.org/x/net/route"
)
var defaultRoute = [4]byte{0, 0, 0, 0}
func main() {