Skip to content

Instantly share code, notes, and snippets.

View Swyter's full-sized avatar
💭
¯\_(ツ)_/¯

Swyter Swyter

💭
¯\_(ツ)_/¯
View GitHub Profile
@pervognsen
pervognsen / shift_dfa.md
Last active January 27, 2024 19:54
Shift-based DFAs

A traditional table-based DFA implementation looks like this:

uint8_t table[NUM_STATES][256]

uint8_t run(const uint8_t *start, const uint8_t *end, uint8_t state) {
    for (const uint8_t *s = start; s != end; s++)
        state = table[state][*s];
    return state;
}
@Swyter
Swyter / terraingen-rescued-lib-perlin.cpp
Last active April 26, 2021 19:54
cmpxchg8b's TerrainGen code; generates a scene mesh from their respective terrain code, just like Mount&Blade Warband does. Recovered from a corrupted disk, these aren't the original filenames.
#include "Perlin.h"
#include "Utils.h"
#include <cmath>
unsigned char g_perlinPermutationTable[256] =
{
198, 12, 146, 95, 44, 18, 240, 28, 151, 32, 45, 20, 30, 23, 141, 248,
168, 254, 178, 85, 92, 216, 236, 175, 47, 88, 67, 136, 234, 1, 72, 106,
79, 220, 24, 171, 26, 224, 128, 137, 223, 16, 105, 195, 231, 183, 29, 132,
241, 122, 252, 135, 5, 181, 130, 213, 49, 204, 70, 176, 144, 35, 64, 104,
@hb3p8
hb3p8 / tiled_voronoi.html
Created March 31, 2021 08:27
Generate normals for car paint base layer
<!DOCTYPE html>
<html>
<head>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<meta charset=utf-8>
</head>
<body>
<canvas width=2048 height=2048 style="width: 800px; height: 800px"></canvas>
</body>
<script language="javascript" src="https://npmcdn.com/regl/dist/regl.js"></script>
@tytydraco
tytydraco / fakeroot-tcp.sh
Created July 24, 2020 23:41
Setup fakeroot-tcp without SystemV IPC support.
#!/bin/bash
cd /tmp
wget http://ftp.debian.org/debian/pool/main/f/fakeroot/fakeroot_1.24.orig.tar.gz
tar xvf fakeroot_1.24.orig.tar.gz
cd fakeroot-1.24/
./bootstrap
./configure --prefix=/opt/fakeroot \
--libdir=/opt/fakeroot/libs \
--disable-static \
@raysan5
raysan5 / custom_game_engines_small_study.md
Last active May 28, 2024 15:33
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like Unreal or Unity for their games (or that's what lot of people think) because d

@nevack
nevack / archived.md
Last active December 19, 2023 00:56
[ARCHIVED] Fix for CSR Dongle 0a12:0001 ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

This gist is currenctly archived.

Please refer to previous revisions if you know what to do.

The patch proposed was merged into kernel in 5.8 release, but no longer working as of linux 5.11

Perfect Quantization of DXT endpoints
-------------------------------------
One of the issues that affect the quality of most DXT compressors is the way floating point colors are rounded.
For example, stb_dxt does:
max16 = (unsigned short)(stb__sclamp((At1_r*yy - At2_r*xy)*frb+0.5f,0,31) << 11);
max16 |= (unsigned short)(stb__sclamp((At1_g*yy - At2_g*xy)*fg +0.5f,0,63) << 5);
max16 |= (unsigned short)(stb__sclamp((At1_b*yy - At2_b*xy)*frb+0.5f,0,31) << 0);
@floooh
floooh / ring.h
Last active June 20, 2019 04:11
simple circular-queue / ringbuffer in C
#define MAX_SLOTS (256)
typedef struct {
uint32_t head; // next slot to enqeue
uint32_t tail; // next slot to dequeue
uint32_t num; // number of slots in ring buffer (plus 1 for empty/full detection)
uint32_t buf[MAX_SLOTS]; // items could be index-handles
} ring_t;
// wrapped index into buf (private helper)
@ckuethe
ckuethe / ghidra_processor_docs_downloader.py
Last active March 5, 2023 19:12
Ghidra Processor Documentation Downloader
#!/usr/bin/env python
# vim: tabstop=4:softtabstop=4:shiftwidth=4:expandtab:
import os
import requests
import sys
docs = {
'68000': {
'M68000PRM.pdf': 'https://www.nxp.com/files-static/archives/doc/ref_manual/M68000PRM.pdf',