Skip to content

Instantly share code, notes, and snippets.

@ForeverZer0
ForeverZer0 / ReshapeWindow.cs
Last active November 5, 2022 17:12
[C#][OpenGL] Maintain aspect ratio when resizing window
/// <summary>
/// Reshapes the drawing are to maintain aspect ratio when the window is resized,
/// using a target pixel ratio to maintain, and applying "pillars" or "letterbox"
/// effect as needed, allowing the drawing context to shrink/grow uniformly.
/// </summary>
/// <param name="width">The new width of the window/drawing area to fit to.</param>
/// <param name="height">The new height of the window/drawing area to fit to.</param>
public void WindowReshape(int width, int height)
{
// Make the projection matrix active
@integeruser
integeruser / s-rand.py
Last active September 24, 2023 14:09
Python port of the GLIBC rng
#!/usr/bin/env python2
from ctypes import c_int, c_uint
# http://www.mscs.dal.ca/~selinger/random/
def srand(seed):
srand.r = [0 for _ in range(34)]
srand.r[0] = c_int(seed).value
for i in range(1, 31):
@hngouveia01
hngouveia01 / debugging_kernel.txt
Last active March 25, 2025 09:35
Debugging kernel code line by line with Qemu and GDB
We are going to use buildroot to download, configure and compile the kernel.
First, download and uncompress buildroot: https://buildroot.org/download.html
Go to the directory and:
make qemu_x86_defconfig
make menuconfig
@Jxck
Jxck / dtls_api.md
Created May 24, 2016 08:21
OpenSSL DTLS API

OpenSSL DTLS API

The API used for DTLS is mostly the same as for TLS, because of the mapping of generic functions to protocol specifc ones. Some additional functions are still necessary, because of the new BIO objects and the timer handling for handshake messages. The generic concept of the API is described in the following sections. Examples of applications using DTLS are available at [9].

DTLS の API は TLS とほぼ同じ。 BIO オブジェクトの生成とタイマのために追加でいくつか必要。