This file contains hidden or 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
void PluginInit() | |
{ | |
g_Module.ScriptInfo.SetAuthor("Yoplitein"); | |
g_Module.ScriptInfo.SetContactInfo("[email protected]"); | |
} | |
void dbgDrawLine(const Vector&in pt1, const Vector&in pt2, uint16 lifetimeDs = 25, uint8 r = 255, uint8 g = 127, uint8 b = 0) | |
{ | |
NetworkMessage msg(MSG_BROADCAST, NetworkMessages::SVC_TEMPENTITY, null); | |
msg.WriteByte(TE_LINE); |
This file contains hidden or 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
#!/usr/bin/env python3 | |
import sys, os, argparse | |
import os.path as p | |
from functools import cmp_to_key | |
from locale import strcoll | |
exampleCommands = """ | |
Typical operation: | |
$ %(prog)s $CLEAN/basedir >clean.txt | |
$ %(prog)s -c clean.txt $DIRTY/basedir >dirty.txt |
This file contains hidden or 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 "serv" | |
dependency "vibe-core" version="*" | |
dependency "vibe-d:http" version="~>0.9.4" | |
versions "VibeDefaultMain" | |
+/ | |
import core.time: hours; | |
import std.algorithm: countUntil; | |
import std.exception: assumeUnique; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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; |