- Author: Richard Wei
- Date: October 2018
This document is written for both the machine learning community and the Swift programming language design community, with a strong focus on language design.
| function await(continuation) | |
| local coro = coroutine.running() | |
| local result | |
| local async | |
| continuation(function(err, value) | |
| if async == nil then | |
| async = false | |
| result = value | |
| if err then error(err) end | |
| return |
This document is written for both the machine learning community and the Swift programming language design community, with a strong focus on language design.
| window.onload = function() { | |
| var v0 = new Vertex("0"); | |
| var v1 = new Vertex("1"); | |
| var v2 = new Vertex("2"); | |
| var v3 = new Vertex("3"); | |
| var v4 = new Vertex("4"); | |
| var v5 = new Vertex("5"); | |
| var v6 = new Vertex("6"); | |
| var v7 = new Vertex("7"); |
| #include <stdio.h> | |
| // #define CLANG_EXTENSION | |
| // Clang compile with -O3 | |
| #define VS_EXTENSION | |
| // https://godbolt.org/z/sVWrF4 | |
| // Clang compile with -O3 -fms-compatibility | |
| // VS2017 compile with /O3 |
| /* Copyright (c) 2018 Arvid Gerstmann. */ | |
| /* This code is licensed under MIT license. */ | |
| #ifndef AG_RANDOM_H | |
| #define AG_RANDOM_H | |
| class splitmix | |
| { | |
| public: | |
| using result_type = uint32_t; | |
| static constexpr result_type (min)() { return 0; } |
| use futures::future::Future; | |
| use libp2p_core::identity; | |
| use libp2p_core::transport::Transport; | |
| use libp2p_core::upgrade::{self}; | |
| use libp2p_core::Multiaddr; | |
| use libp2p_noise::{Keypair, NoiseConfig, X25519}; | |
| use libp2p_tcp::TcpConfig; | |
| use tokio::{self, io}; | |
| fn main() { |
Accessing a subnet that is behind a WireGuard client using a site-to-site setup
We want to access a local subnet remotely, but it is behind a NAT firewall and we can't setup port forwarding. Outgoing connections work, but all incoming connections get DROPPED by the ISP's routing policy.
| // | |
| // Lookup Tables for Transvoxel's Modified Marching Cubes | |
| // | |
| // Unlike the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm), these tables guarantee | |
| // a closed mesh "whose connected components are continuous and free of holes." | |
| // | |
| // Rotations are prioritised over inversions so that 3 of the 6 cases containing ambiguous faces are never added. 3 extra | |
| // cases are added as a post-process, overriding inverses through custom-build rotations to eliminate the rest. | |
| // | |
| // Uses the exact same co-ordinate system as https://gist.github.com/dwilliamson/c041e3454a713e58baf6e4f8e5fffecd |