Skip to content

Instantly share code, notes, and snippets.

View forksnd's full-sized avatar
🍴
Forking together, for great pleasure

forksnd

🍴
Forking together, for great pleasure
View GitHub Profile
@forksnd
forksnd / T0.md
Created June 30, 2022 11:30 — forked from graphitemaster/T0.md
Vulkan Tutorial

Tutorial 0

What is Vulkan

Vulkan is a low-overhead, cross-platform 3D graphics and compute API.

Vulkan targets

Vulkan targets high-performance realtime 3D graphics applications such as games and interactive media across multiple platforms providing higher performance and lower CPU usage.

// From: https://github.com/BartMassey/printf-tests/blob/master/drivers/c/testcases.c
/* XXX This code generated automatically by gen-testcases.hs
from ../../printf-tests.txt . You probably do not want to
manually edit this file. */
result |= test(1, "0.33", "%.*f", 2, 0.33333333);
result |= test(2, "foo", "%.3s", "foobar");
result |= test(3, " 00004", "%10.5d", 4);
result |= test(416, "hi x\\n", "%*sx\\n", -3, "hi");
result |= test(4, " 42", "% d", 42);
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef DOUBLE_FROM_CHARS_TEST_CASES_HPP
#define DOUBLE_FROM_CHARS_TEST_CASES_HPP
#include <charconv>
#include <stddef.h>
#include <system_error>
using namespace std;
@forksnd
forksnd / lz4.py
Created June 18, 2023 12:59 — forked from mmozeiko/lz4.py
lz4 decompression in Python 2.x
# Warning: this implementation doesn't check if writes or reads will happen
# out of input/output buffer range, so that will generate IndexError exception
def LZ4_decompress(source, osize):
isize = len(source)
src = bytearray(source)
dst = bytearray(osize)
si = 0
@forksnd
forksnd / lmdb.tcl
Created June 18, 2023 13:05 — forked from antirez/lmdb.tcl
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
#include <windows.h>
#include <stdio.h>
typedef struct ldr_data_entry
{
LIST_ENTRY LinkedList;
LIST_ENTRY UnusedList;
PVOID BaseAddress;
PVOID Reserved2[1];
@forksnd
forksnd / noise.sh
Created September 13, 2024 09:12 — forked from rsvp/noise.sh
noise : relaxing ambient Brown noise generator (cf. white noise) | Linux bash script using sox | CogSci notes
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2019-01-02
#
# _______________| noise : ambient Brown noise generator (cf. white noise).
#
# Usage: noise [minutes=59] [band-pass freq center=1786] [wave]
# ^minutes can be any positive integer.
# Command "noise 1" will display peak-level meter.
#
# Dependencies: play (from sox package)
@forksnd
forksnd / locate-pointer-starter.sh
Created September 13, 2024 09:12 — forked from hjhsalo/locate-pointer-starter.sh
Locate mouse pointer (Highlight is removed after a certain amount of loop cycles. Optional bash startup script to prevent duplicate instances.)
#!/bin/bash
# A simple script to check if a process is running and if it is will
# kill and restart the process
# Modified from example provided at:
# https://www.m00nie.com/2011/12/script-to-check-if-a-process-is-running-and-if-not-start-it/
################################################
# The name of the program to check
PROGRAM=locate-pointer
################################################
@forksnd
forksnd / sl3.c
Created October 3, 2024 14:02
A minimal Lisp interpreter
/* A minimal Lisp interpreter
Copyright 2004 Andru Luvisi
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License , or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@forksnd
forksnd / MagicRingBuffer.h
Created October 8, 2024 03:46 — forked from mmozeiko/MagicRingBuffer.h
Magic RingBuffer for Windows, Linux and macOS
#pragma once
//
// Magic Ring Buffer
// https://gist.github.com/mmozeiko/3b09a340f3c53e5eaed699a1aea95250
//
// Sets up memory mapping so the same memory block follows itself in virtual address space:
//
// [abcd...xyz][abc...xyz]
//