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
static void writefln(String fmt, Object... args) | |
{ | |
System.out.println( | |
args.length == 0 ? | |
fmt : | |
String.format(fmt, args) | |
); | |
} |
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
struct Set(T) | |
{ | |
private import std.range: empty, enumerate, takeExactly; | |
private alias This = typeof(this); | |
private alias Nil = void[0]; // superior to empty struct, has .sizeof == 0 | |
private Nil[T] set; | |
void add(T v) | |
{ |
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
alias id(alias x) = x; | |
struct seq(_xs...) | |
{ | |
alias xs = _xs; | |
} | |
enum isSeq(alias x) = is(x: seq!xs, xs...); | |
template seqAppend(seqs...) |
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
from http.server import HTTPServer, SimpleHTTPRequestHandler | |
from sys import argv | |
# teach the request handler about common MIME types | |
# fixes e.g. JS/WASM/etc. failing to load in some browsers | |
mimeTypes = {} | |
mimeTypes.update({ | |
".html": "text/html", | |
".css": "text/css", | |
".json": "text/json", |
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
/** | |
Sequentially schedules a series of CompletableFutures, i.e. earlier futures | |
must complete before subsequent futures are scheduled. | |
Assumes tasks is a stream which generates futures on demand. | |
A stream over an existing set of futures will not work as expected, | |
as they all will have already been scheduled. | |
*/ | |
static CompletableFuture<Void> chainAsync(Stream<CompletableFuture<?>> tasks, Executor pool) | |
{ |
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 collections, select, socket, sys, time, types | |
_transient_callbacks = collections.deque() | |
_timed_callbacks = [] | |
_blocked_callbacks = [] | |
_now = time.time() | |
_poll = select.epoll() | |
class _Sleep: | |
__slots__ = ["delay"] |
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
// Port of https://github.com/KdotJPG/OpenSimplex2/blob/e09a94744b3d69e4c58ce615445f18712cb50104/java/OpenSimplex2.java | |
#![allow(non_snake_case)] | |
/*! | |
K.jpg's OpenSimplex 2, faster variant | |
*/ | |
use std::{num::Wrapping, sync::Once}; | |
const PRIME_X: i64 = 0x5205402B9270C86F; |
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 std.traits; | |
To quantize(To, From)(From val) | |
if(isFloatingPoint!From && isIntegral!To && isSigned!To) | |
in(val >= -1.0 && val <= 1.0) | |
{ | |
return cast(To)( | |
(To.max - To.min) // unsigned equivalent's .max | |
* ((val + 1) / 2) // val from [-1.0, 1.0] -> [0.0, 1.0] | |
+ To.min // shift back into signed value range |
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
/++dub.sdl: | |
name "dnstest" | |
versions "VibeDefaultMain" | |
dependency "vibe-core" version="~>1.9.3" | |
+/ | |
import std.socket: AddressFamily; |
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
# Maintainer: Sanpi <sanpi+aur@homecomputing.fr> | |
pkgname=emsdk | |
pkgver=1.35 | |
pkgrel=6 | |
pkgdesc='The Emscripten SDK' | |
arch=('x86_64') | |
url='https://kripken.github.io/emscripten-site/' | |
license=('MIT') | |
depends=('python2' 'cmake') | |
source=("https://github.com/emscripten-core/emsdk/archive/master.zip" |