Skip to content

Instantly share code, notes, and snippets.

View sin-ack's full-sized avatar

Synchronization Acknowledgement sin-ack

View GitHub Profile
@sin-ack
sin-ack / zig_compiler_simulator.py
Last active July 30, 2022 01:11
Zig Compiler Simulator 2022
import random
import sys
import time
import pathlib
import re
AST_LOWERING_TOTAL = 600
AST_LOWERING_INCREMENT = 50
SEMA_TOTAL = 45000
SEMA_INCREMENT_MIN = 350
@sin-ack
sin-ack / the_variant_of_python.py
Created July 19, 2022 12:39
How to make mypy sweat
_TranslatedM = TypeVar("_TranslatedM", bound="TranslatedModel", covariant=True)
class TranslationModelBase(Generic[_TranslatedM], Model):
"""Base class for translation models."""
language = models.ForeignKey["Language", "Language"](
to="Language", on_delete=models.CASCADE, verbose_name=_("Language")
)
parent: "models.ForeignKey[_TranslatedM, _TranslatedM]"
@sin-ack
sin-ack / font.cpp
Last active March 11, 2021 15:22
Very over-engineered font rendering for OpenGL
bool
Font::render_batch(
glm::mat4 const &projection, std::vector<FontSpec> const &strings,
Program *shader) {
// Load VAO and VBO
glBindVertexArray(s_vao);
glBindBuffer(GL_ARRAY_BUFFER, s_vbo);
// Use the shader program specified.
if (shader == nullptr) {