Skip to content

Instantly share code, notes, and snippets.

View apples's full-sized avatar
🏳️‍🌈

Apples apples

🏳️‍🌈
View GitHub Profile
@apples
apples / stir_fry.md
Last active June 6, 2021 19:04
Ol' Appelli's Texas Stir Fry

Ol' Appelli's Genuine Texas Stir Fry

A pretty easy recipe once you get the hang of it, but requires a few unusual items that you likely don't have laying around.

Works better on a traditional flame wok, but a modern stovetop wok works just as well. Just keep in mind that non-stick woks are not designed to sit at extremely high temperatures, so don't let it get too crazy hot in the preheating phase.

I recommend using a spatula designed for woks (these usually have a bit more of a "spoon" shape to them), but if you don't have one then use a wooden spoon works well enough.

@apples
apples / powershell_app_executable.md
Last active March 31, 2021 20:40
PowerShell 4 Dummies - Chapter 69: Obtaining info about an app package

Firstly, a "package" is a collection of files, and may contain multiple "applications", which are the executables.

You can list the details about the package with Get-AppxPackage, as discussed.

PS C:\Users\dbral> $pkg = get-appxpackage -name *terminal*
PS C:\Users\dbral> $pkg


Name : Microsoft.WindowsTerminal
@apples
apples / pack_quaternion.hpp
Created March 24, 2021 19:58
Quaternion (un)packing function, smallest-three representation.
#pragma once
#include <glm/gtc/quaternion.hpp>
#include <cassert>
#include <cmath>
#include <cstdint>
/** Creates smallest-three packing of quaternion, 10 bits per component */
inline auto pack_quaternion(glm::quat q) -> std::uint32_t {
@apples
apples / lock_free_queue.hpp
Created November 29, 2020 10:14
Easy peasy lock-free queue
#pragma once
#include <atomic>
#include <optional>
template <typename T>
class lock_free_queue {
public:
using value_type = T;
@apples
apples / efraimidis_spirakis.cpp
Created May 5, 2020 06:03
Implementations of algorithms A-Res and A-ExpJ from Efraimidis and Spirakis.
#include <iostream>
#include <random>
#include <vector>
#include <queue>
#include <cmath>
#include <array>
#include <algorithm>
#include <iterator>
/*
@apples
apples / linq.lua
Created March 4, 2020 06:10
Lua implementation of some common LINQ methods.
local linq = {}
local where_iter = {}
local select_iter = {}
local concat_iter = {}
local drop_iter = {}
-- linq base
linq.__index = linq
@apples
apples / PKGBUILD
Created September 11, 2019 04:05
RE/flex msys2 pkgbuild
_realname=reflex
pkgbase=mingw-w64-x86_64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.4.0
pkgrel=1
pkgdesc="Regex-centric, fast lexical analyzer generator for C++ with full Unicode support (mingw-w64)"
arch=('any')
url="https://www.genivia.com/doc/reflex/html/index.html"
license=('BSD-3')
depends=()

Database usertype

#include <ginseng/ginseng.hpp>
#include <sol.hpp>

auto create_ginseng_usertype(sol::state_view& lua) -> sol::simple_usertype<ginseng::database> {
    using ginseng::database;
    using ent_id = database::ent_id;
    

Backend renderer interface:

class render_context {
public:
    virtual ~render_context() = 0;
    virtual void begin() = 0;
    virtual void end() = 0;
 virtual void draw_rectangle(const std::string&amp; texture, glm::vec2 position, glm::vec2 size) = 0;