Skip to content

Instantly share code, notes, and snippets.

@wiltonlazary
wiltonlazary / Http3Server.java
Created December 18, 2022 03:19 — forked from normanmaurer/Http3Server.java
Http3Server on top of netty
/*
* Copyright 2020 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@wiltonlazary
wiltonlazary / CrockfordBase32.java
Created December 17, 2020 01:52 — forked from markov/CrockfordBase32.java
Crockford Base32 Encoder and Decoder written in Java. It is a shameless adaptation of the Base32 encoder from apache commons-condec. I would have loved to just extend from their BaseNCodec class, but alas it is not designed for extension...
import java.nio.charset.Charset;
/**
* <p>Provides Base32 encoding and decoding as defined by <a href="http://www.ietf.org/rfc/rfc4648.txt">RFC 4648</a>.
* However it uses a custom alphabet first coined by Douglas Crockford. Only addition to the alphabet is that 'u' and
* 'U' characters decode as if they were 'V' to improve mistakes by human input.<p/>
* <p>
* This class operates directly on byte streams, and not character streams.
* </p>
*
default prefix byte = 'S'
default terminator byte = '\n'
0x30 = '0', 0x31 = '1', etc
Hard Reset
command: any of S00\n , S10\n , S20\n , S30\n
response: none
Scanner Enable
enabled by default; only needed after Not-On-File or Scanner Disable
const instances = {}
const modules = {}
const components = {}
const renderer = {
instances,
modules,
components
}

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

"Monads are Monoids in the Category of Endofunctors"
If you are a functional programmer, you've probably heard this statement before.
To understand it, first we need to understand its component parts:
. Category
. Monoid
. Endofunctor
After this, we will glue those parts together piece by piece to grasp the whole.
@wiltonlazary
wiltonlazary / python_implementation
Created October 14, 2018 09:47 — forked from gavinwahl/python_implementation
Triggers to enforce referential integrity for foreign keys, if postgres didn't support them natively.
CREATE OR REPLACE FUNCTION check_fk_child() RETURNS trigger AS $$
DECLARE
fk_local TEXT := TG_ARGV[0];
parent_table TEXT := TG_ARGV[1];
fk_val INT;
is_valid BOOLEAN;
query TEXT;
BEGIN
-- fk_val = getattr(NEW, fk_local)
EXECUTE format('SELECT $1.%I', fk_local) USING NEW INTO fk_val;
@wiltonlazary
wiltonlazary / Demonstrations.ml
Created June 7, 2018 08:53 — forked from caiorss/Demonstrations.ml
Quick self-contained demonstration of coroutine pipes in OCaml. - Talk given by Rizo Isrof
(**
Talk given by Rizo Isrof
- https://pusher.com/sessions/meetup/the-realtime-guild/realtime-stream-processing-with-coroutines
- https://www.reddit.com/r/ocaml/comments/66pe0s/stream_processing_with_coroutines_from_c_to_ocaml/
*)
# empty ;;
- : ('a, 'b, unit) pipe = Ready ()
#
@wiltonlazary
wiltonlazary / getKType.kt
Created June 2, 2018 07:37 — forked from udalov/getKType.kt
Obtain KType instance from reified T
import java.lang.reflect.*
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.reflect.KTypeProjection
import kotlin.reflect.KVariance
import kotlin.reflect.full.createType
// --- Interface ---
inline fun <reified T : Any> getKType(): KType =
@wiltonlazary
wiltonlazary / ThreadPool.hx
Created May 22, 2018 12:05 — forked from hamaluik/ThreadPool.hx
Platform-agnostic thread pool for Haxe / OpenFL
package com.blazingmammothgames.util;
#if neko
import neko.vm.Thread;
import neko.vm.Mutex;
#elseif cpp
import cpp.vm.Thread;
import cpp.vm.Mutex;
#end