Skip to content

Instantly share code, notes, and snippets.

// prints how long in the past the current "end" of the stream is
// this is a lower bound on latency that's viewer-independent
// put in the m3u of a stream
// e.g. just open network tab, refresh, then filter for m3u
// don't use the meta one (the first) but the one that's called repeatedly
const playlistUrl = "";
async function test() {
const minNow = new Date().getTime();
schema {
query: Object159
mutation: Object2
subscription: Object1
}
interface Interface1 {
field1604: ID!
field1605: ID
field1606: String
@Yogu
Yogu / aggregators.md
Last active June 17, 2019 16:59
cruddl aggregators (draft)

Collect fields

With the @collect directive, you can define fields that are not persisted but rather compute their value when queried, based on other fields. It allows you to follow a path of relations, child entities and other fields, collect these values and optionally apply aggregations on them.

Basics

Relations and child entity let you define a graph of objects that can be selected by regular GraphQL fields. If you're not interested in the graph structure but only in the objects, you can define a @collect field that follows a path and collects all objects on the way:

type OrderItem @childEntity {
@Yogu
Yogu / socket-keeper.ts
Last active March 19, 2020 23:51
max-age for keep-alive in node
import { injectable } from 'inversify';
import { Logger } from 'log4js';
import { Socket } from 'net';
import Timer = NodeJS.Timer;
export interface KeepaliveOptions {
/**
* The maximum time in milliseconds an unused socket will be kept alive before it will be closed
*
* This should be set to a smaller value than the server's keepalive timeout to avoid a race condition
@Yogu
Yogu / format-message.d.ts
Last active September 11, 2018 15:10
format-message typings (outdated, see this PR: https://github.com/format-message/format-message/pull/206)
declare module 'format-message-parse' {
namespace parse {
export type AST = Element[]
export type Element = string | Placeholder
export type Placeholder = Plural | Styled | Typed | Simple
export type Plural = [string, 'plural' | 'selectordinal', number, SubMessages]
export type Styled = [string, string, string | SubMessages]
export type Typed = [string, string]
export type Simple = [string]
interval cycles total time median latency median runtime 99% percentile latency 99% percentile runtime 99.9% percentile latency 99.9% percentile runtime maximum latency maximum runtime
500000 20000 00:00:10 8005 937 21275 2343 31436 28750 41410 51509
500000 40000 00:00:20 15080 1770 17790 1979 24525 2500 37257 3542
500000 80000 00:00:40 15175 1719 18188 2031 24735 2760 46518 5364
500000 160000 00:01:20 15055 1770 17672 1980 23859 2500 46035 4323
500000 320000 00:02:40 15269 1719 17935 2031 23190 2448 32124 4010
500000 640000 00:05:20 15193 1770 17692 1979 20731 2448 34344 3958
500000 1280000 00:10:40 15232 1770 17576 1979 22202 2240 50918 31146
500000 2560000 00:21:20 15086 1770 17600 1979 19680 2344 48288 4167
500000 5120000 00:42:40 15064 1770 17537 1979 19592 2395 47834 12864
type max avg
native 116 16
native 109 19
native 123 17
native 194 16
native 125 19
native 118 17
native 141 17
native 126 17
native 132 16
@Yogu
Yogu / block-texture.png
Last active July 26, 2017 21:48
blockstates-extended
block-texture.png
@Yogu
Yogu / block-texture.png
Last active January 1, 2017 17:50
blockstate-info
block-texture.png
<script>
window.onbeforeunload = function() {
return "confirm";
}
var i = 0;
setInterval(function() {
document.getElementById('display').innerHTML = i++;
}, 100);