This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install tip-of-tree Emscripten | |
$ emsdk install tot | |
$ emsdk activate tot | |
# Build with Embind and Asyncify enabled | |
$ emcc --bind -s ASYNCIFY mylib.cpp -o mylib.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener('fetch', event => { | |
if (event.request.method === 'PUT') { | |
event.respondWith(handleRequest(event)); | |
} | |
}); | |
async function handleRequest(event) { | |
let response = await fetch(event.request); | |
if (!response.ok) return response; | |
let urls = ['/']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function supportsImgType(type) { | |
// Create | |
// | |
// <picture> | |
// <source srcset="data:,x" type="{type}" /> | |
// <img /> | |
// </picture> | |
// | |
// (where "data:,x" is just a minimal URL that is valid but doesn't trigger network) | |
let img = document.createElement('img'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Don't ask about this one. I have no idea what this magic is. | |
// Copied from https://github.com/microsoft/TypeScript/issues/13298#issuecomment-724542300. | |
type UnionToIntersection<U> = ( | |
U extends any ? (arg: U) => any : never | |
) extends (arg: infer I) => void | |
? I | |
: never; | |
// Continuation of above. | |
type UnionToTuple<T> = UnionToIntersection<(T extends any ? (t: T) => T : never)> extends (_: any) => infer W |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground link: https://www.typescriptlang.org/play?#code/PTAEHEEsGcBdQG4FMBO1IHsB2AuUALWWAB2hxAHMZYA6K2fAVwCMaBjDAW2ACUelkaVMABMAZgCMbMQDYAHAFZFAQwAmCkWwAMSACwB2VXJHN98hQu1IFAWABQ92AE9iSUAFEAHkjYAeAMJcnMpYqtAANKAAyrDKsG4AvKAA3qBwymwA1ngA2gC6kQA2GGzKhWQpAL6glQB8oAn2oKCBnMGh0KBInvEdoDmQWABmqC1BIaqRNNODIyig-HB5TaAA-B7efouwkV4+re2qvjFxSJEHE7W1K3gn8QDc9o4ubgDygiiQqki+r8wAVpEAHLKThnUAANTKjCQ9SSILBXR6SD6cE+WAoaxSKxyAGlQINQAAKTJIJwYIagP7-ACUoAAPqAEUg8nh8d1emEmaC3OsoYUYaA8NS8aAAGTE0nkynUmnLOzVPBYASoR4OOzOVwQJCwfkw34A4E8uHcxEclFcqUUqkArEi5l5IWgZWCNXPLUAFUYxEKPyBSM5nSwjE4zFQkR4AYtnRCTnyDX6eRNPByAHJfRiGKnHea+v71pG8F6fX7IjlY1Npjwk267IN4ighhk3ECkBQgSGwyhfABBZidXNc4Oh1D1VLKihxSDIPB9zqVd0ttu+D0mj1RvNtjsj7uzUZz+rrOdO9eDoOd0brVvti-d1dOl2qp4al6gOcrtcbrnX7dd3x7+Y53vI9+3XIsv3PHcsTA50VRQWtNTcHtiB9JwokgCgsBXSIAAUMAHZE+mYDAMF9EITTwgjA1AWAUEFdYYOvD8ENfcAdXQzCPwTU9CO-Ldb18Ycu0PUAm3KNw8FomEWK1ABZRhCg4rCe0iAAhE0chU0BVJzXjOhyKTwUMx1GRyMToHBcyWSxQynSsmS3CiENf1QXsIOdW81PcoTRwTHJphoYtfV7WpK0C71gvUvI0wzCgs0dCUfPg59EOiFggp+Ht3NjfIvLPUAcq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url | total_opt_br | total_strip_br | regression_abs | regression_pct | |
---|---|---|---|---|---|
https://oso-web-demo.s3.us-west-2.amazonaws.com/de568a042820fcd97a6f.module.wasm | 335016 | 305069 | 29947 | 9.8 | |
https://sigmausd.io/d0324a003154b2d64e31.module.wasm | 273841 | 252292 | 21549 | 8.5 | |
https://pc.meitu.com/public/dist/js/lib/RenderModule.wasm | 343220 | 316664 | 26556 | 8.4 | |
https://gulch.io/client-1.25.5.wasm.wasm | 179059 | 165584 | 13475 | 8.1 | |
https://app.roboxmaker.com/aker-app.wasm | 654078 | 608232 | 45846 | 7.5 | |
https://sdkathlos.it/avatar/insalute//js_wordpress/nyumaya.wasm | 255076 | 237325 | 17751 | 7.5 | |
https://playground.buttplug.world/dist/8b4ec1dfc3ee2ffb9df7.module.wasm | 753814 | 704467 | 49347 | 7.0 | |
https://solve.prod.portal.onscale.com/d102b71af6dc744954ce.module.wasm | 587557 | 549528 | 38029 | 6.9 | |
https://eventin.space/tflite-wasm/tflite-wasm-simd.wasm | 493826 | 462458 | 31368 | 6.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -Wglobals Clang plugin | |
// | |
// Based on example plugins and searching Clang's API documentation. | |
// BEWARE! This is my first ever attempt at a Clang plugin. | |
// | |
// Written by John Bartholomew <jpa.bartholomew@gmail.com> | |
#include "clang/Frontend/FrontendPluginRegistry.h" | |
#include "clang/AST/AST.h" | |
#include "clang/AST/ASTConsumer.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
# Read the image | |
img = cv2.imread('sky.jpg') | |
# Convert the image to grayscale | |
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) | |
# Use a threshold to detect stars in the image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
===== | |
parse | |
===== | |
canada x serde_json x 14.41 ops/sec ±3.31% (40 runs sampled) | |
canada x serde_wasm_bindgen x 90.55 ops/sec ±0.53% (77 runs sampled) | |
canada x msgpack x 101 ops/sec ±1.90% (72 runs sampled) | |
citm_catalog x serde_json x 131 ops/sec ±0.64% (83 runs sampled) | |
citm_catalog x serde_wasm_bindgen x 192 ops/sec ±1.02% (85 runs sampled) | |
citm_catalog x msgpack x 161 ops/sec ±1.09% (82 runs sampled) | |
twitter x serde_json x 203 ops/sec ±0.89% (85 runs sampled) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Atmo; | |
public class Interop | |
{ | |
public static void HelloWorld() | |
{ | |
Console.WriteLine(DateTimeOffset.UnixEpoch); | |
} | |
static void Main() { |