Skip to content

Instantly share code, notes, and snippets.

View Olivki's full-sized avatar
🏠
Working from home

Oliver Berg Olivki

🏠
Working from home
View GitHub Profile
@Olivki
Olivki / based.kt
Created February 19, 2021 21:57
based tips
val based = byteArrayOf(0, 0, 0, 32, 102, 116, 121, 112, 105, 115, 111, 109, 0, 0, 2, 0, 105, 115, 111, 109, 105, 115, 111, 50, 97, 118, 99, 49, 109, 112, 52, 49, 0, 0, 21, -89, 109, 111, 111, 118, 0, 0, 0, 108, 109, 118, 104, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -24, 0, 0, 15, 107, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 9, -119, 116, 114, 97, 107, 0, 0, 0, 92, 116, 107, 104, 100, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 15, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 2, -128, 0, 0, 1, 104, 0, 0, 0, 0, 0, 36, 101, 100, 116, 115, 0, 0, 0, 28, 101, 108, 115, 116, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 15, 64, 0, 0, 7, -46, 0, 1, 0, 0, 0, 0, 9, 1, 109, 100, 105, 97
@Olivki
Olivki / XNB.kt
Last active December 13, 2018 22:39
Epic haha
fun read(input: File): Any {
var buffer: ByteBuffer = ByteBuffer.wrap(input.readBytes())
buffer.order(ByteOrder.LITTLE_ENDIAN) // Everything in the XNB Format is in the little endian order.
// The 3 starting bytes of XNB formatted containers will *always* be X, N, B.
// So if the given file doesn't conform to that, we throw an exception to save ourselves from headaches later
// on.
if (buffer.getString(3) != "XNB")
throw XnbException("${input.name} is not encoded in the XNB Container Format.")