Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
//https://www.cs.jhu.edu/~misha/MyPapers/EUROG20.pdf Appendix A
namespace PolygonCenterFinder
{
public static class PolygonCenter
{
public static Vector2 GetPolygonCenter(Vector2[] verts)
{
@stepney141
stepney141 / BookmarkAPI_en.md
Last active December 10, 2025 02:53
(DEPRECATED) Twitter Undocumented Endpoints for Bookmark
@cerebrate
cerebrate / README.md
Last active October 23, 2025 04:01
Recompile your WSL2 kernel - support for snaps, apparmor, lxc, etc.

WARNING

THIS GIST IS EXTREMELY OBSOLETE. DO NOT FOLLOW THESE INSTRUCTIONS. SERIOUSLY.

IF YOU IGNORE THE ABOVE WARNING, YOU AGREE IN ADVANCE THAT YOU DIDN'T GET THESE INSTRUCTIONS FROM ME, THAT I WARNED YOU, AND THAT I RESERVE THE RIGHT TO POINT AND LAUGH MOCKINGLY IF AND WHEN SOMETHING BREAKS HORRIBLY.

I'll do a write-up of current custom-kernel procedures over on Random Bytes ( https://randombytes.substack.com/ ) one day soon.

NOTE

@markknol
markknol / shadertoy.md
Last active February 21, 2026 12:39
Shader cheatsheet (from shadertoy)

This help only covers the parts of GLSL ES that are relevant for Shadertoy. For the complete specification please have a look at GLSL ES specification

Language:

Version: WebGL 2.0
Arithmetic: ( ) + - ! * / %
Logical/Relatonal: ~ < > <= >= == != && ||
Bit Operators: & ^ | << >>
Comments: // /* */
Types: void bool int uint float vec2 vec3 vec4 bvec2 bvec3 bvec4 ivec2 ivec3 ivec4 uvec2 uvec3 uvec4 mat2 mat3 mat4 mat?x? sampler2D, sampler3D samplerCube
Format: float a = 1.0; int b = 1; uint i = 1U; int i = 0x1;

@nus
nus / main.cpp
Last active October 23, 2025 20:42
An example of emscripten with WebSocket.
// $ em++ -lwebsocket.js -o index.html main.cpp
#include <emscripten/emscripten.h>
#include <emscripten/websocket.h>
#include <stdio.h>
EM_BOOL onopen(int eventType, const EmscriptenWebSocketOpenEvent *websocketEvent, void *userData) {
puts("onopen");
EMSCRIPTEN_RESULT result;
@DownWithUp
DownWithUp / BeepDriverIOCTL.c
Created October 26, 2018 13:48
Use an IOCTL to create a beep from Beep.sys
#include <Windows.h>
#include <stdio.h>
#include <winternl.h>
typedef struct _BEEP_SETTINGS {
ULONG ulFrequency;
ULONG ulDuration;
} BEEP_SETTINGS;
void main() {
@souravrane
souravrane / Scanline.c
Last active January 12, 2024 00:53
OpenGL - Scanline filling algorithm
#include<stdio.h>
#include<GL/glut.h>
#include<math.h>
int le[500], re[500], flag=0 ,m;
void init()
{
@Caaz
Caaz / polygon.lua
Created January 7, 2018 12:15
Rendering polygons in pico-8
-- require partials/class.lua
class.polygon = class{
new = function(this,args)
merge(this,{
points = {},
lines = {}
})
merge(this,args)
this:rasterize()
end,
@michaellihs
michaellihs / twisted.md
Last active August 27, 2024 17:07
Write your own ssh Server with the Python Twisted library

SSH Server with the Python Twisted Library

Installing the library

Assuming you have Python installed on your system:

pip install twisted
pip install pyOpenSSL
pip install service_identity
@t-mat
t-mat / minimal_vst2x_host.cpp
Last active February 4, 2026 09:36
WIN32 : Minimal VST 2.x host in C++11.
// Win32 : Minimal VST 2.x Synth host in C++11.
//
// This is a simplified version of the following project by hotwatermorning :
// A sample VST Host Application for C++ Advent Calendar 2013 5th day.
// https://github.com/hotwatermorning/VstHostDemo
//
// Usage :
// 1. Compile & Run this program.
// 2. Select your VST Synth DLL.
// 3. Press QWERTY, ZXCV, etc.